Hi All
I am referring to http://www.ibiblio.org/obp/thinkCSpy/chap09.htm
>>> tuple = ('a', 'b', 'c', 'd', 'e')
>>> tuple[0]
'a'
And the slice operator selects a range of elements.
>>> tuple[1:3]
('b', 'c')
But if we try to modify one of the elements of the tuple, we get a error:
>>> tuple[0] = 'A'
TypeError: object doesn't support item assignment
Of course, even if we can't modify the elements of a tuple, we can
replace it with a different tuple:
>>> tuple = ('A',) + tuple[1:]
>>> tuple
('A', 'b', 'c', 'd', 'e')
How does tuple = ('A',) + tuple[1:] this work ????
Please explain me with an example
Thanks
Regards
Kaushal
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor