Script
#!/usr/local/bin/python3.4
list = [ 'VVSL', 281 , 99.94, 'Kumble', 15921 ]
smalllist = [13288, 'Dravid']
print(list) # Prints complete list
print(list[0]) # Prints the first element of the list
print(list[1]) # Prints the second element of the list
print(list[2]) # Prints the third element of the list
print(list[1:3]) # Prints the elements starting from 2nd till 3rd
print(list[4:]) # Prints the elements starting from fourth element
print(smalllist * 3) # Prints the small list three times
print(list + smalllist) # Prints the concatenated lists
Execution
['VVSL', 281, 99.94, 'Kumble', 15921]
VVSL
281
99.94
[281, 99.94]
[15921]
[13288, 'Dravid', 13288, 'Dravid', 13288, 'Dravid']
['VVSL', 281, 99.94, 'Kumble', 15921, 13288, 'Dravid']
#!/usr/local/bin/python3.4
list = [ 'VVSL', 281 , 99.94, 'Kumble', 15921 ]
smalllist = [13288, 'Dravid']
print(list) # Prints complete list
print(list[0]) # Prints the first element of the list
print(list[1]) # Prints the second element of the list
print(list[2]) # Prints the third element of the list
print(list[1:3]) # Prints the elements starting from 2nd till 3rd
print(list[4:]) # Prints the elements starting from fourth element
print(smalllist * 3) # Prints the small list three times
print(list + smalllist) # Prints the concatenated lists
Execution
['VVSL', 281, 99.94, 'Kumble', 15921]
VVSL
281
99.94
[281, 99.94]
[15921]
[13288, 'Dravid', 13288, 'Dravid', 13288, 'Dravid']
['VVSL', 281, 99.94, 'Kumble', 15921, 13288, 'Dravid']
No comments:
Post a Comment