Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Exercise: Convert for-loop to while-loop

  • Update the following file.

  • Given a for-loop as in the following code, convert it to be using a while-loop.

  • Range with 3 parameters: from the first number, till the second number, with step the 3rd number range(from, to, step)


for ix in range(3, 25, 4):
    print(ix)
3
7
11
15
19
23