Thread: Fibonacci
View Single Post
Old Apr 27th, 2005, 1:59 PM   #1
lingon
Newbie
 
Join Date: Apr 2005
Posts: 17
Rep Power: 0 lingon is on a distinguished road
Fibonacci

Hey!
I am trying to make a program that calculates the fibonacci series up to a cetain value and it worked fine but when I tried to add a feature that asks you to type a number and then calculate the serie up to that number it jst keeps going and going. I don't think that it understands that it is actually a number that I type. Have a look.

fib = raw_input("Skriv en siffra:")
newnumb = fib 
def fib(newnumb):
    a, b = 0, 1
    while b < newnumb:
         print b,
         a, b = b, a+b
fib(newnumb)

Last edited by lingon; Apr 27th, 2005 at 2:03 PM.
lingon is offline   Reply With Quote