0415_4

Run Settings
LanguagePython
Language Version
Run Command
#4. **Fibonacci Sequence** #result = fibonacci(8) #print(result) def fibonacci(n): fib_seq = [0,1] while len(fib_seq) < n: # less than 2 fib_seq.append(fib_seq[-1] + fib_seq[-2]) # add the last 2 number #fib_seq.append(fib_seq[len(fib_seq)-1] + fib_seq[len(fib_seq)-2] return fib_seq result = fibonacci(8) print(result)
Editor Settings
Theme
Key bindings
Full width
Lines