Replace this line with your code. n = [3, 5, 7] def total(numbers): result=0 for x in numbers: result+=x return result print total(n)
a function ends the moment a return keyword is reached, which in your case happens in the first run of the loop, you might want to change the intend of return so your whole for loop can run
Thank you so much !
Had the same doubt
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.