Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created Jul 10, 2020
Embed
What would you like to do?
#creating dictionary by using dict()constructor - mapping
d=dict({'red':1,'blue':2,'green':3})
print (d) #Output:{'red': 1, 'blue': 2, 'green': 3}
#creating dictionary by using dict()constructor - mapping. keyword arguments can also be passed.
d=dict({'red':1,'blue':2},green=3)
print (d) #Output:{'red': 1, 'blue': 2, 'green': 3}
#without dict() constructor
d={'red':1,'blue':2,'green':3}
print (d)#Output:{'red': 1, 'blue': 2, 'green': 3}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment