Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created Jul 11, 2020
Embed
What would you like to do?
#Creating dictionary in which all keys are True.
d={1:'apple',2:'orange',3:'banana'}
print (all(d)) #Output:True
print (any(d))#Output: True
#Empty dictionary
d1={}
print (all(d1))#Output: True
print (any(d1))#Output:False
#Creating dictionary in which one key is False
d2={0:'grapes',1:'apple',2:'orange',3:'banana'}
print (all(d2))#Output:False
print (any(d2))#Output:True
#Creating dictionary in which all keys are False
d3={0:'hello'}
print (all(d3))#Output:False
print (any(d3))#Output:False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment