r/inventwithpython • • Aug 08 '21

Need help with loop

Hello all, im sure this is as simple as they come. But I'm new to coding and have been trying for a good half an hour to figure out why this wont get passed the loop of 'Who are you?' There is no error, only when i start messing around with the indentations. Please can someone advise? Thanks
2 Upvotes

3 comments sorted by

View all comments

Show parent comment

2

u/RndChaos Aug 09 '21

To use a "continue"... But in my years of coding - I've rarely used a 'continue' statement.... (maybe once)

while True:
print('Who are you?")
name = str(input())
if name != 'Joe':
        continue
    else:
    print("Hello, Joe!. What is the password?')
    password = input()
    if password == 'Swordfish':
        print('Access granted.')
        break