What is the output of the following Python code snippet?
s = 'hello'
s[0] = 'H'
s[0] = 'H'
Correct answer
A. Error
6 views
A. Error
6 views
Strings are immutable, so item assignment raises TypeError.
Asked in: Python Interview Strings
https://docs.python.org/3/library/stdtypes.html#string-methodsNot sure why the answer is A? Ask here and get an explanation.