I need to write a python code which checks for equality for the entered pin second time and then proceeds further. Here is how my code goes:
id1 = int(input("Enter 4-digit account pin: "))
id2 = int(input("Re-Enter 4-digit account pin for confirmation: "))
if id1 == id2:
id = id1
else:
id2 = int(input("Incorrect pin.. Please Re-enter: "))
Here after my pin gets verified it needs to get assigned to a variable named id
. But the above code works only when I enter the incorrect pin once. If I enter again, the code continues to the next step. I want the code to repeat the equality check until both the entered pins are equal and after confirmed as equal, needed to get assigned to the variable id
. Please help.