Created
February 28, 2017 10:04
-
-
Save pmgupte/f1d10b5992013551217033d25f700506 to your computer and use it in GitHub Desktop.
Python code to check if all the values in dictionary are zero.
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
d = {'a': 0, 'c': 0, 'b': 0, 'd': 0} | |
l = d.values() | |
s = set(l) | |
if len(s) == 1 and list(s)[0] == 0: | |
print "all 0" | |
else: | |
print "not all 0" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment