Method to get value in Dictionary based on key

Method to get value in Dictionary based on key

get() method is used to get a value from Dictionary using key. Below is the simple program:

--------

name = {1:"TalentEve",2:"Embeddeddesignblog",3:"YouTube-Way2Know",4:"Myvision-thisworld"}
print(name.get(2))

The above code prints Embeddeddesignblog as 2 is the key for embeddeddesignblog

Post a Comment

0 Comments