summaryrefslogtreecommitdiffstats
path: root/Demo/scripts/fact.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-01-01 19:35:13 (GMT)
committerGuido van Rossum <guido@python.org>1992-01-01 19:35:13 (GMT)
commitbdfcfccbe591e15221f35add01132174c9b4e669 (patch)
tree7e5f0d52b8c44e623b12e8f4b5cd645c361e5aeb /Demo/scripts/fact.py
parent4d8e859e8f0a209a7e999ce9cc0988156c795949 (diff)
downloadcpython-bdfcfccbe591e15221f35add01132174c9b4e669.zip
cpython-bdfcfccbe591e15221f35add01132174c9b4e669.tar.gz
cpython-bdfcfccbe591e15221f35add01132174c9b4e669.tar.bz2
New == syntax
Diffstat (limited to 'Demo/scripts/fact.py')
-rwxr-xr-xDemo/scripts/fact.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Demo/scripts/fact.py b/Demo/scripts/fact.py
index 6aac414..b406086 100755
--- a/Demo/scripts/fact.py
+++ b/Demo/scripts/fact.py
@@ -12,17 +12,17 @@ error = 'fact.error' # exception
def fact(n):
if n < 1: raise error # fact() argument should be >= 1
- if n = 1: return [] # special case
+ if n == 1: return [] # special case
res = []
# Treat even factors special, so we can use i = i+2 later
- while n%2 = 0:
+ while n%2 == 0:
res.append(2)
n = n/2
# Try odd numbers up to sqrt(n)
limit = sqrt(n+1)
i = 3
while i <= limit:
- if n%i = 0:
+ if n%i == 0:
res.append(i)
n = n/i
limit = sqrt(n+1)