15
Question Question 15
If you give the following for str1 = "Hello", why does Python report error?
str1[2] = 'p'
Answer
Python reports error because strings are immutable and hence item assignment is not supported.
If you give the following for str1 = "Hello", why does Python report error?
str1[2] = 'p'
Answer
Python reports error because strings are immutable and hence item assignment is not supported.