There is mistake in the statement 7:
x[1][1] = 'y'
Before this statement, the value in x equals 'abcdd'. It has the type string.
String in Python is the immutable type (documentation: https://docs.python.org/3/library/stdtypes.html). That why we can’t change the string by index.
If you run this code, you will get the following message:
Comments
Leave a comment