Python List

list1 = [ "abcd", 786, 2.23, "john", 70.2]
tinylist = [123, "john"]

print (list1)              # Prints complete list
print (list1[0])           # Prints first element of the list
print (list1[1:3])         # Prints elements start from 2nd til 3rd
print (list1[2:])          # Prints elements starting from 3rd elements
print (tinylist * 2)       # Prints list two times
print (list + tinylist)    # Prints concatenated lists

Comments

Popular posts from this blog

WAN Technology

LO3 - Know the features and functions of information systems

WDD - LO1 - MANAGE SECURE SITES