+ 2

Could I have done it better?

I just tried my hand at a Fibonacci sequence generator and, I want to know if there is a better way to get the same results. https://code.sololearn.com/cOzEEH1C6m43 code: i,F1,F2,Fn = 0,0,0,0 fib_seq = {} while i <= 15: Fn = F1 + F2 fib_seq[i] = Fn i += 1 if F1 == 0: F1 += 1 else: F1,F2 = F2,Fn print(list(fib_seq.values())) output: [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610]

18th Oct 2017, 8:24 PM
Turner Lee
Turner Lee - avatar
4 odpowiedzi
+ 3
https://code.sololearn.com/c4baNTx6kKxC/?ref=app here how you could do it different.
18th Oct 2017, 7:32 PM
AutomatedpROCESSES
AutomatedpROCESSES - avatar
18th Oct 2017, 10:28 PM
Ferhat Sevim
Ferhat Sevim - avatar
+ 2
You can make alternations My try in python: https://code.sololearn.com/cRdvpVrWwP57/?ref=app
17th Nov 2017, 1:37 AM
#RahulVerma
#RahulVerma - avatar
19th Oct 2017, 12:57 PM
Turner Lee
Turner Lee - avatar