Answers for "python while loop continue not working"

5

python while continue

## When the program execution reaches a continue statement, 
## the program execution immediately jumps back to the start 
## of the loop.
while True:
    print('Who are you?')
    name = input()
    if name != 'Joe':
        continue
    print('Hello, Joe. What is the password? (It is a fish.)')
    password = input()
    if password == 'swordfish':
        break
print('Access granted.')
Posted by: Guest on February-24-2020
0

while loop in python for do you want to continue

while True:
    # some code here
    if input('Do You Want To Continue? ') != 'y':
        break
Posted by: Guest on September-15-2020

Python Answers by Framework

Browse Popular Code Answers by Language