''' This code use array syntax ''' myArray=[] myArray.append(1) myArray.append(2) myArray.append(6) myArray.append(3) print "Array length ",len(myArray) ''' access array data ''' print myArray for n in myArray: print n for i in range(0,len(myArray)): print myArray[i] ''' sort array ''' myArray.sort() print myArray
Output:
Array length 4 [1, 2, 6, 3] 1 2 6 3 1 2 6 3 [1, 2, 3, 6]
0 comments:
Post a Comment