my first real program blows up, can someone tell me why?
Jerry F. Davis
jfdecd at execpc.com
Sun Mar 5 11:26:05 EST 2000
I read the tutorial and tried a variation on what i saw there. and it
blew up, with a integer overflow. can someone tell me why?
Looks like a nice language so far. One that I would want to teach my 15
year old son. I wouldn't want to teach him pearl, because it is so
cryptic in nature.
thanks.
I am running python 1.5.2 on linux.
Here is the program:
#!/usr/bin/python
# why does this give me a integer overflow?
import sys
def fib(n):
print 'a Fibonacci series up to', n
a, b = 0, 1
while b < n:
print b,
a, b = b, a+b
l = len(sys.argv)
if l == 1:
print """
fibonacci3: print out a fibonacci sequence.
usage: fibonacci3 value
"""
else:
x = sys.argv[1]
print 'now doing fib(', x, ')'
fib(x)
More information about the Python-list
mailing list