so my code is

- Code: Select all
`#fibbonacci program`

fib= [0, 1,]

def find_next_fib():

a= len(fib) -1

b= len(fib) -2

next_fib = fib[a] + fib[b]

fib.append(next_fib)

print next_fib

print 0

print 1

while next_fib < 100:

find_next_fib()

print "This is all the fibbonacci numbers up to 100"

But my problem is next_fib is only defined within the function, find_next_fib().

Again, I don't want the answer, I still want to finish the code myself, but how do I define next_fib universally, instead of within the function? I also tried

- Code: Select all
`def find_next_fib():`

a= len(fib) -1

b= len(fib) -2

next_fib = fib[a] + fib[b]

fib.append(next_fib)

print next_fib

return next_fib

and

- Code: Select all
`def find_next_fib():`

a= len(fib) -1

b= len(fib) -2

next_fib = fib[a] + fib[b]

fib.append(next_fib)

print next_fib

while next_fib < 100:

return true

but the first one wouldn't define next_fib outside of the function, and the second wouldn't return true outside of the function.

--thty