Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created July 11, 2020 01:36
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save IndhumathyChelliah/41b5a6df6f003c1a53734b378e1afdc1 to your computer and use it in GitHub Desktop.
#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