I want Else statement to be shown once if it's wrong. Please see the code which I tried.
lists = ['apple','grape','pineapple','orange']
password = "xyz"
def pass1():
for i in lists:
if i == password:
print("Accepted!", "Password : " + i)
break
else:
print("Password not found! Try again")
pass1()
Output:
Password not found! Try again
Password not found! Try again
Password not found! Try again
Password not found! Try again
Process finished with exit code 0