Debian Codegraph @

primes/matho-sum

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 #!/usr/bin/python
2
3 # Python program to sum many large integers separated by spaces or newlines.
4 # The integers to sum may be entered on the command-line or into standard input.
5
6 import string
7 import sys
8
9 sum = 0 # initialize sum and make it an integer
10 args = sys.argv[1:]
11 if (args == []):
12 # read stdin if no command line args
13 while True:
14 try:
15 input_line = raw_input()
16 except:
17 break;
18 for s in string.split(input_line):
19 sum += int(s)
20 else:
21 # sum together the command-line args
22 for arg in args:
23 sum += int(arg)
24 print sum