+ 1

Code

What is the output of this code? def func(x): res = 0 for i in range(x): res += i return res print(func(4)) The answer is 6 ??

25th Feb 2018, 9:14 AM
Jordan
Jordan  - avatar
1 Answer
+ 6
range(4) returns [0, 1, 2, 3] 0+1+2+3 = 6
25th Feb 2018, 9:23 AM
ChaoticDawg
ChaoticDawg - avatar