summaryrefslogtreecommitdiffstats
path: root/Demo/scripts
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2008-09-13 01:43:28 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2008-09-13 01:43:28 (GMT)
commit2a9b9cbea08c7c22a328926b0e0719fb197743a0 (patch)
tree51c8930c097a35c97db9cdae6f5af889424cf9bd /Demo/scripts
parente91fcbdf691c687d1195fad342564e0b3442f444 (diff)
downloadcpython-2a9b9cbea08c7c22a328926b0e0719fb197743a0.zip
cpython-2a9b9cbea08c7c22a328926b0e0719fb197743a0.tar.gz
cpython-2a9b9cbea08c7c22a328926b0e0719fb197743a0.tar.bz2
#687648 from Robert Schuppenies: use classic division.
Diffstat (limited to 'Demo/scripts')
-rwxr-xr-xDemo/scripts/fact.py4
-rwxr-xr-xDemo/scripts/ftpstats.py4
-rwxr-xr-xDemo/scripts/lpwatch.py4
-rwxr-xr-xDemo/scripts/markov.py2
-rwxr-xr-xDemo/scripts/pi.py4
-rwxr-xr-xDemo/scripts/unbirthday.py6
6 files changed, 12 insertions, 12 deletions
diff --git a/Demo/scripts/fact.py b/Demo/scripts/fact.py
index 03cab8b..6dafa66 100755
--- a/Demo/scripts/fact.py
+++ b/Demo/scripts/fact.py
@@ -17,14 +17,14 @@ def fact(n):
# Treat even factors special, so we can use i = i+2 later
while n%2 == 0:
res.append(2)
- n = n/2
+ n = n//2
# Try odd numbers up to sqrt(n)
limit = sqrt(float(n+1))
i = 3
while i <= limit:
if n%i == 0:
res.append(i)
- n = n/i
+ n = n//i
limit = sqrt(n+1)
else:
i = i+2
diff --git a/Demo/scripts/ftpstats.py b/Demo/scripts/ftpstats.py
index 5c1599e..881b717 100755
--- a/Demo/scripts/ftpstats.py
+++ b/Demo/scripts/ftpstats.py
@@ -104,7 +104,7 @@ def main():
def showbar(dict, title):
n = len(title)
- print '='*((70-n)/2), title, '='*((71-n)/2)
+ print '='*((70-n)//2), title, '='*((71-n)//2)
list = []
keys = dict.keys()
keys.sort()
@@ -126,7 +126,7 @@ def show(dict, title, maxitems):
if len(dict) > maxitems:
title = title + ' (first %d)'%maxitems
n = len(title)
- print '='*((70-n)/2), title, '='*((71-n)/2)
+ print '='*((70-n)//2), title, '='*((71-n)//2)
list = []
keys = dict.keys()
for key in keys:
diff --git a/Demo/scripts/lpwatch.py b/Demo/scripts/lpwatch.py
index 8887dee..715cbb8 100755
--- a/Demo/scripts/lpwatch.py
+++ b/Demo/scripts/lpwatch.py
@@ -83,7 +83,7 @@ def makestatus(name, thisuser):
lines.append(line)
#
if totaljobs:
- line = '%d K' % ((totalbytes+1023)/1024)
+ line = '%d K' % ((totalbytes+1023)//1024)
if totaljobs <> len(users):
line = line + ' (%d jobs)' % totaljobs
if len(users) == 1:
@@ -95,7 +95,7 @@ def makestatus(name, thisuser):
line = line + ' (%s first)' % thisuser
else:
line = line + ' (%d K before %s)' % (
- (aheadbytes+1023)/1024, thisuser)
+ (aheadbytes+1023)//1024, thisuser)
lines.append(line)
#
sts = pipe.close()
diff --git a/Demo/scripts/markov.py b/Demo/scripts/markov.py
index bddec56..7a4fc01 100755
--- a/Demo/scripts/markov.py
+++ b/Demo/scripts/markov.py
@@ -110,7 +110,7 @@ def test():
def tuple(list):
if len(list) == 0: return ()
if len(list) == 1: return (list[0],)
- i = len(list)/2
+ i = len(list)//2
return tuple(list[:i]) + tuple(list[i:])
if __name__ == "__main__":
diff --git a/Demo/scripts/pi.py b/Demo/scripts/pi.py
index 9b24245..e6e3b82 100755
--- a/Demo/scripts/pi.py
+++ b/Demo/scripts/pi.py
@@ -17,11 +17,11 @@ def main():
p, q, k = k*k, 2L*k+1L, k+1L
a, b, a1, b1 = a1, b1, p*a+q*a1, p*b+q*b1
# Print common digits
- d, d1 = a/b, a1/b1
+ d, d1 = a//b, a1//b1
while d == d1:
output(d)
a, a1 = 10L*(a%b), 10L*(a1%b1)
- d, d1 = a/b, a1/b1
+ d, d1 = a//b, a1//b1
def output(d):
# Use write() to avoid spaces between the digits
diff --git a/Demo/scripts/unbirthday.py b/Demo/scripts/unbirthday.py
index 2d0b8e5..8ed9084 100755
--- a/Demo/scripts/unbirthday.py
+++ b/Demo/scripts/unbirthday.py
@@ -92,9 +92,9 @@ def mkdate((year, month, day)):
# even though that day never actually existed and the calendar
# was different then...
days = year*365 # years, roughly
- days = days + (year+3)/4 # plus leap years, roughly
- days = days - (year+99)/100 # minus non-leap years every century
- days = days + (year+399)/400 # plus leap years every 4 centirues
+ days = days + (year+3)//4 # plus leap years, roughly
+ days = days - (year+99)//100 # minus non-leap years every century
+ days = days + (year+399)//400 # plus leap years every 4 centirues
for i in range(1, month):
if i == 2 and calendar.isleap(year):
days = days + 29