Wrong with this script?

Steven Bethard steven.bethard at gmail.com
Sat Mar 5 16:10:55 EST 2005


R.Meijer wrote:
> Hi, I've been busy with an experimental script, and I can't seem to
> see what is wrong with it, can somebody tell me?

For future notice, it's useful to

(1) explain what it is you want your script to do, and
(2) explain what it currently does (including an exception traceback if 
one is printed)

Using my mind-reading powers, I'd suggest that maybe you want something 
like:

py> for limit in iter(lambda: raw_input('What number? '), ''):
...     if limit == "help":
...         print "The Fibonacci series..."
...     else:
...         a, b = 0, 1
...         limit = int(limit)
...         while b < limit:
...             print b
...             a, b = b, a+b
...
[... I type '6' ...]
1
1
2
3
5
[... I type '13' ...]
1
1
2
3
5
8
[... I type '' (nothing) ...]
py>

STeVe



More information about the Python-list mailing list