Last answered:

10 Nov 2022

Posted on:

05 Nov 2022

0

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)
Instructor
Posted on:

10 Nov 2022

0

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

Submit an answer

  • Javascript
  • Python
  • Ruby
  • PHP
  • Java
  • C
  • C#
  • C++
  • HTML
  • SQL
  • R