Basic While Loop Structure

This lesson shows you the basic syntax of a while-loop by example. Additionally, the code is debugged in a live session to show you, what’s happening behind the scenes. A simple while-loop may look like this:

n = 5
while n > 0:
    n = n - 1

Comments & Discussion

Become a Member to join the conversation.