Break and continue | Python Language Forum
H
Heena Goyal Posted on 11/08/2023
I was practicing this code, same as written by you, but it'sgiving me output as "You are not allowed even when password is correct. Why is it happening?

secretword='abc'
password=''
max_attempt=5
count=0
authorization=False

while password != secretword:
    count+=1
    if count>max_attempt: 
        break
    if count==3: 
        continue
    password=input(f"{count} - Please enter your Password:" )
else:
    authorization:True

print("You are authorised to access the application." if authorization else "You are not allowed.")

H
Heena Goyal Replied on 18/08/2023

Please let me know why I am having problem in executing the code while the code is same as yours.