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.")
Instructor
Yogesh Chawla Replied on 15/04/2024
Use authorization=True, colon will not work here. The code will work.