0

While trying to create fabianski sequence..the second one aint working..can't find out y..😕😕

https://code.sololearn.com/c1GHh7LYh7ot/?ref=app

11th Aug 2019, 7:53 AM
Y AD Ù
Y AD Ù - avatar
4 Answers
+ 2
It's because of lines 20-21. Do it like this: c,d = d,c+d
11th Aug 2019, 11:38 AM
Diego
Diego - avatar
+ 1
In your code, "d = c+d" uses "c = d" (because it's executed first), so line 21 is basically doing " d = d + d". If you put it all in one line, the RHS is evaluated first (using the old values for "c" and "d") and then gets assigned to the LHS.
11th Aug 2019, 1:40 PM
Diego
Diego - avatar
+ 1
Cleared..thnks for the explanation Diego 😄
11th Aug 2019, 5:26 PM
Y AD Ù
Y AD Ù - avatar
0
What's the difference Diego ..?
11th Aug 2019, 12:23 PM
Y AD Ù
Y AD Ù - avatar