summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-03-30 11:15:49 (GMT)
committerGuido van Rossum <guido@python.org>1992-03-30 11:15:49 (GMT)
commit3a585bb964483f2892f5a7bfc8e899806a1dc247 (patch)
tree15b73e8ef9c968bbf631c8fb704b1f3fba1e4183
parent9a6757dadeab6077f26f3bdfda17585780468121 (diff)
downloadcpython-3a585bb964483f2892f5a7bfc8e899806a1dc247.zip
cpython-3a585bb964483f2892f5a7bfc8e899806a1dc247.tar.gz
cpython-3a585bb964483f2892f5a7bfc8e899806a1dc247.tar.bz2
small fixes
-rwxr-xr-xDemo/scripts/fact.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Demo/scripts/fact.py b/Demo/scripts/fact.py
index b406086..4833e08 100755
--- a/Demo/scripts/fact.py
+++ b/Demo/scripts/fact.py
@@ -19,7 +19,7 @@ def fact(n):
res.append(2)
n = n/2
# Try odd numbers up to sqrt(n)
- limit = sqrt(n+1)
+ limit = sqrt(float(n+1))
i = 3
while i <= limit:
if n%i == 0:
@@ -28,7 +28,8 @@ def fact(n):
limit = sqrt(n+1)
else:
i = i+2
- res.append(n)
+ if n != 1:
+ res.append(n)
return res
def main():