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 |
# This is a Python program to display large factorials and test "fact.py". |
| 4 |
|
| 5 |
from fact import factorial |
| 6 |
import sys |
| 7 |
import os |
| 8 |
import string |
| 9 |
|
| 10 |
def usage(): |
| 11 |
print "This program calculates large factorials." |
| 12 |
print "Requires and tests \"fact.py\"." |
| 13 |
print |
| 14 |
print "Usage: %s integer_expressions" % os.path.basename(sys.argv[0]) |
| 15 |
print |
| 16 |
print "The integer expressions should be separated by spaces." |
| 17 |
print "A factorial is the product of all positive integers <= a given integer." |
| 18 |
sys.exit(2) |
| 19 |
|
| 20 |
args = sys.argv[1:] |
| 21 |
if (args == []): |
| 22 |
usage() |
| 23 |
else: |
| 24 |
try: |
| 25 |
num = eval(string.join(args)) |
| 26 |
print "factorial(", num, ") =", factorial(num) |
| 27 |
except: |
| 28 |
for arg in args: |
| 29 |
num = eval(arg) |
| 30 |
print "factorial(", num, ") =", factorial(num) |