Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren0
Can anyone plz elaborate how this code works line by line or just generalise the 6th line
Please write the 6th in general form https://code.sololearn.com/cfGvTBet5HfX/?ref=app num = int(input()) a = 0 b = 1 while a <= num: #10 print(a) a,b = b,a+b
4 Antworten
+ 4
Line 6 could be rewritten like this:
c = a + b
a = b
b = c
+ 3
Line 6 as it is saves us one variable (c)
It assigns the inital b to a and the initial a+b to b in the same line
+ 1
Hey Lisa i really appreciate your help and its working but i failed to understand the reason behind it.It'd would be really nice of u to please explain the changes. :(:
+ 1
Nevermind i understood and really thanks for the help