Guys what is Perform first can you help me (a , b = b , a+b) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Guys what is Perform first can you help me (a , b = b , a+b)

29th Aug 2018, 12:37 PM
Real Gutch
Real Gutch - avatar
3 Answers
+ 3
Markus Kaleton i confused in Fibonacci Step because if i use a = b b = a+b the result is wrong but if i use a,b=b,a+b the result is correct why?😐
29th Aug 2018, 12:58 PM
Real Gutch
Real Gutch - avatar
+ 1
because the assignments on the line are executed at the same time. so in the a,b version a = 1 , b = 2 prints 1 | a = 2 , b = 3 prints 2 | a = 3 , b = 5 prints 3 but in the two line version the assignment of a happens in the previous line so it doesnt happen at the same time so a = 1 , b = 2 prints 1 / / a = 2 , b = 4 prints 2 / / a = 4 , b = 8 hope that helps. basically the second one does two assignments where the first one does only one draw it on paper, it might help understand
29th Aug 2018, 1:12 PM
Markus Kaleton
Markus Kaleton - avatar
0
'b' is assigned to 'a' variable 'a+b' is assigned to 'b' variable but it is a simultaneous assignment of values fibonacci?
29th Aug 2018, 12:44 PM
Markus Kaleton
Markus Kaleton - avatar