Created
May 1, 2012 00:27
-
-
Save yuheiomori/2563960 to your computer and use it in GitHub Desktop.
CodeEval Sum of Digits
This file contains hidden or 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
import sys | |
def sum_of_digits(line): | |
return sum([int(e) for e in line]) | |
if __name__ == '__main__': | |
test_cases = open(sys.argv[1], 'r') | |
for line in test_cases: | |
print sum_of_digits(line.rstrip()) | |
test_cases.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment