x, y = y, x+y meaning? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

x, y = y, x+y meaning?

Could you explain the steps occuring? Def f(n): x = y = 1.0 for i in range (1,n): x,y = y, x+y return y/x Print (f(3))

10th Oct 2019, 10:32 PM
rae
2 Answers
+ 1
x, y = y, x+y x is assigned y y is assigned x+y
10th Oct 2019, 10:47 PM
Odyel
Odyel - avatar
+ 1
Sorry, mistype. Should be y/x
10th Oct 2019, 10:50 PM
rae