I am doing the question in exercise with using for loop and if statement,the result came out to be 1
1 answers ( 0 marked as helpful)
Tsvetelin Tsonkov
Instructor
Hi Muhammad!
Thanks for reaching out.
The return statement should have the same indentation with the for loop. Written this way, the result will be 1 because you return the result immediately after the first incrementation.
Hope this helps.
Best,
Tsvetelin