+ 2
Problem with a security system code
I am attempting to create a security system code for Python and am having several issues at the moment. I was able to get the whole code to work flawlessly until I tried to add an exception for if the user name was not entered correctly and this is where my problems started. I would greatly appreciate it if anyone was able to help me out. Code is in the answer comments. - mT
1 Resposta
0
import time
import random
#Testing Variables for ease of editing
x = 0
y = 1
z = 5
print("What is your name?")
__user_name__ = input()
print("Is " + __user_name__ + " correct?")
print("Yes or No?")
__name_answer__ = input()
if __name_answer__ == "Yes" or "yes" or "y":
print("Please enter a secure password.")
__user_password__ = input()
print("Please confirm your password.")
__confirm_password__ = input()
if __confirm_password__ == __user_password__:
#print()
w = 1445
else:
while __name_answer__ != "Yes" or "yes" or "y":
print("What is your name?")
__user_name__ = input()
print("Is " + __user_name__ + " correct?")
__name_answer__ = input("Yes or No?")
#This else statement deals with the case of the confirm password being incorrect and enters a loop until the confirmed password is correct
while __user_password__ != __confirm_password__:
print("Password confirm Incorrect!\nPlease enter a new password.")
__user_password__ = input()
print("Please confirm your password")
__confirm_password__ = input()
if __confirm_password__ == __user_password__:
continue
#This is the end of the log in/register phase
print("You have been logged in.\n Welcome " + __user_name__ + ".")