Monday, 5 May 2014

Lists

Multiple variables can be initialized with a common value in a single statement. a=b=c=10

Multiple variables can be initialized with differing values in a single statement. a,b,c = 1,2,3

A python list is a variable that can store multiple items of data that are indexed starting at zero.
Nums = [0,1,2,3,4,5]

Lists can have multiple dimensions 
     [0] [1] [2]
[0]  1    2   3
[1]  4    5   6

Example 1
              quarter = ['January', 'February', 'March']

               print("The first month is", quarter[0])
                                                                                                                                                                           

Example 2
                 coords = [[1,2,3],[4,5,6]]
                 print("Top left is".....
                 print("Bottom right is".....