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 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