Another fibonacci snippet

jasimp 0 Tallied Votes 143 Views Share

This one works pretty fast, even for large numbers. Like it says, aproxomite end number, and that is because it will generally go one fibonacci number above what you specify.

# Might need "raw_input("message")" to run 
d = input("Aproxomite End Number ")
a,b = 1,0
while b < d:
        sum = a + b
        a = b
        b = sum
        print b
ilovepython1978 0 Newbie Poster

Good and interesting!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.