YouTip LogoYouTip

Python Exercise Example90

# Python2.x Python Exercise Instance 90 [![Image 3: Python 100 Examples](#) Python 100 Examples](#) **Title:** List usage example. **Program Analysis:** None. ## Instance (Python 2.0+) ```python #!/usr/bin/python # -*- coding: UTF-8 -*- #list #Create a new list testList=[10086,'China Mobile',[1,2,4,5]] #Access the length of the list print len(testList) #To the end of the list print testList[1:] #Add elements to the list testList.append('i'm new here!') print len(testList) print testList #Pop the last element of the list print testList.pop(1) print len(testList) print testList #list comprehension #There's an introduction later, skip it for now matrix = [[1, 2, 3], [4, 5,
← Python Exercise Example91Python Exercise Example89 β†’