07-While Loop infinite loop.py

Sign up Free. Don't forget to check out our challenges, lessons, solve and learn series and more ...

Code Snippet

#  An infinite loop.
#  Remember that 1 (or any value other than 0) represents true.
#  Press Ctrl-C to interrupt this program run.

x = 1
while x:
    print ('Hi moose')
    x = x + 1
    print ('I love you')
    print ('Press the Ctrl key and the C key together')
    print ('to interrupt this program...')
print ('done')
print ('yup - I am loving Python')

Try it yourself