name = list('Pearl')
name
['P','e','a,'r','l'']
name[2:] = list('ar')
name
['P','e','a','r']
List statement turned the string ('Pearl') into a list.
The list('ar') replaces anything from position 2 onwards in the name list, hence it's new value being ['P','e','a','r']
Tuesday, 22 March 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment