1 list = ['a', 'b', 'c', 'd']
2 print list[1:-1] ## ['b', 'c']
3 list[0:2] = 'z' ## replace ['a', 'b'] with ['z']
4 print list ## ['z', 'c', 'd']
1#!/usr/bin/python
2
3aList = [123, 'xyz', 'zara', 'abc']
4aList.insert( 3, 2009)
5print "Final List : ", aList
1 list = [1, 2, 3]
2 print list.append(4) ## NO, does not work, append() returns None
3 ## Correct pattern:
4 list.append(4)
5 print list ## [1, 2, 3, 4]