Learn Python 3 Loop Challanges First one

Hi hope someone can help me since I dont understand why i get “41” back as respons insted of the “3”
hope you can see the printscreen i took. Super happy if anyone can help! thanks

counter is the variable you are using to keep track of how many numbers meet the criteria of being divisible by 10. Yet, you are also using the exact same variable to loop over the nums list.

In your solution, you initialize counter as 0. In the very next line that existing value of counter is over-written by the first number of the nums list. So with the argument list in your screenshot, counter is now going to be 20. The condition will be true and counter will be incremented to 21. The next iteration of the loop will begin and the next number in the nums list i.e. 25 will be assigned to counter and the same process as above repeats. For the given argument, counter will be taking on the values 0, 20, 21, 25, 30, 31, 35, 40, 41. The last value assigned to counter will be returned by the function.

The variable you use to keep track of the total i.e. counter should not be used as the looping variable as well. Instead you could use for num in nums: (or some other variable of your choice). You will want to check the divisibility of num by 10. If true, then counter should be incremented by 1.