for i in d: # Here key and the vaule can be any type.
print i,d[i] # Accessing elements in the dictionary
# Order in which they display is also different in output
print d.keys() # print all keys in a dictionary
print d.values() # print all values in a dictionary
No comments:
Post a Comment