How to check if all keys of a dictionary are true in Python

1 Answer

0 votes
dict = {0: 'False'}
print(all(dict))
 
dict = {0: 'False', 1: 'True'}
print(all(dict))

dict = {1: 'a', 2: 'b'}
print(all(dict))
 
dict = {False: 0, 0: 'False'}
print(all(dict))
 
dict = {'0': 'False'}
print(all(dict))
 
dict = {}
print(all(dict))
 
 
 
 
 
'''
run:
 
False
False
True
False
True
True
 
'''

 



answered Apr 25, 2021 by avibootz

Related questions

1 answer 147 views
4 answers 448 views
2 answers 191 views
2 answers 151 views
2 answers 155 views
2 answers 155 views
...