-
-
Save IndhumathyChelliah/4a786a285966de04a471910ce50fdad2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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