0
Modules
How output is 6 for below : def func(x): res = 0 for i in range(x): res += i return res print (func(4))
1 Resposta
+ 2
What does this have to do with Modules?
Please try to find a fitting title for your questions.
func is called with 4.
range(4) becomes 0, 1, 2, 3.
If you add all these numbers to res, it's six.