09-Use of continue statement in a while loop.py

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

Code Snippet

while 1:
    print ('The meaning of life......')
    answer = input('Press y for the meaning of life: ')
    if answer == 'y':
        print ('Ahh.....the search has begun: ')
        continue #use of the continue statement
    answer = input('Had enough yet? ')
    if answer == 'y':
print ('Have a ')
print ('nice day!')

Try it yourself