do while loop

  • do while

  • There is no do ... while in Python but we can write code like this to have similar effect.


examples/loops/do_while.py

while True:
    answer = input("What is the meaning of life? ")
    if answer == '42':
        print("Yeeah, that's it!")
        break

print("done")