Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created Jul 10, 2020
Embed
What would you like to do?
d=dict([('red',1),('blue',2),('green',3)])
print (d)#Output:{'red': 1, 'blue': 2, 'green': 3}
#Checking whether the particular key is in dictionary or not.
if 'red' in d:
print ("True")#Output:True
if 'yellow' in d:
print ("True")
else:
print ("False") #Output:False
if "yellow" not in d:
print ("True")#Output:True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment