Python Programming - Variables - Discussion
Discussion Forum : Variables - General Questions (Q.No. 20)
20.
What is the output of the following code:
my_string = "hello"
my_string[1] = "a"
print(my_string)
Answer: Option
Explanation:
In Python, strings are immutable, which means their individual characters cannot be modified once they're created.
Attempting to change a character of a string using the index operator [ ] results in a TypeError.
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers