while loops

https://docs.python.org/3/reference/compound_stmts.html#while

INTRODUCTION

The 'while' statement is used for repeated execution as long as an expression is true.


# Syntax.
while condition1:
    statements
    if condition2:
        break       # optional, terminate the loop without executing 'else'
    statements
    if condition3:
        continue    # optional, go to condition1
    statements
else:               # optional
    statements      # executed if condition1 is false, the loop terminates

n = 27
while n > 0:
    if n == 13:
        n = n - 1
        continue   # skipping 13
    print(n)
    if (n % 2) == 0:
        n = n // 2
    else:
        n = n - 1

while True:   # infinite loop
    #reply = raw_input("Input word (or 'stop'):")   # Py2
    reply = input("Input word (or 'stop'):")   # Py3
    if reply == "stop":
        break
    print(reply.upper())