python - Fibonacci list how do i make a conditional that excludes a number -
fib = [0,1] = 1 b = 0 = 0 while < n: = a+b a,b = i, fib.append(i)
this works in cases 'n' (which given variable) number in actual fibonacci sequence, 21 or 13. however, if number six, adds 1 more number should. list should not contain number greater n.
you add a
list first, incrementing.
fib = [0] a, b = 1, 0 while <= n: fib.append(a) a,b = a+b,
Comments
Post a Comment