+ 3
Please explain
Can you explain why the answer is: 6 def func(x): res = 0 for i in range(x): res += i return res print(func(4))
1 Answer
+ 4
This( for loop) start from value i=0 to i=3 for x=4 so res = 0+1+2+3 =6
Can you explain why the answer is: 6 def func(x): res = 0 for i in range(x): res += i return res print(func(4))