Anonymous asked in Computers & InternetProgramming & Design · 4 weeks ago

what does while i<n+1 mean in python?

will it perform the loop n times or n+1 times? just a little confused..

2 Answers

  • 4 weeks ago

    i < n + 1 is simply just a statement. It's a statement saying that i is less than n + 1. It's a statement just like "Today is Tuesday" is a statement. It's either a true statement or a false statement. If it is a true statement then the loop continues, and if it is a false statement or becomes false then the loop aborts.

  • keerok
    Lv 7
    4 weeks ago

    It will loop until i >= n+1.

Still have questions? Get your answers by asking now.