0

explanation plzzzz!!!

def func(x): res = 0 for i in range(x): res += i return res print(func(4))

20th Mar 2019, 8:48 AM
Azfar
Azfar - avatar
2 Antworten
+ 4
res = 0 for i in range(4) # i= 1, 2, 3 i= 0 res += i # res ----- 0 i = 1 res += i #res ----- 1 i= 2 res += i #res ----- 3 i = 3 res += i #res ----- 6
20th Mar 2019, 8:56 AM
Sarthak Pokhrel
Sarthak Pokhrel - avatar
20th Mar 2019, 8:59 AM
Prokopios Poulimenos
Prokopios Poulimenos - avatar