How many times will this while loop (in Python) execute?
1 2 3 4 |
|
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Relevant wiki: While
The condition for the while loop to continue is that i ≡ 0 ( m o d 2 ) ⟹ i ≡ 1 ( m o d 2 ) .
Initialy i = 1 and each time i is set to i + 2 this means i ≡ 1 ( m o d 2 ) so the loop will continue Infinitely