Skip to content

Instantly share code, notes, and snippets.

@yuheiomori
Created May 1, 2012 00:27
Show Gist options
  • Save yuheiomori/2563960 to your computer and use it in GitHub Desktop.
Save yuheiomori/2563960 to your computer and use it in GitHub Desktop.
CodeEval Sum of Digits
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