]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
small fixes
authorGuido van Rossum <guido@python.org>
Mon, 30 Mar 1992 11:15:49 +0000 (11:15 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 30 Mar 1992 11:15:49 +0000 (11:15 +0000)
Demo/scripts/fact.py

index b406086819d066573a728e942d94dea3ea04c3f6..4833e0892d0a4d12e8088140f3a5626ee95b08e7 100755 (executable)
@@ -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():