- Code: Select all
user = ""
passWd = ""
confUser = ""
confPassWd = ""
user = input("create your username: ")
passWd = input("create your password: ")
# the issue with this running is that it is not giving the user a second go
# at typing in their password IE a chance to confirm their password.
# the code is attempting to check a username and password against the original
# entry, and there is nothing stored to check against. If this went through they
#would not be guessing their username or password at all
#I also need to use Global variables to store the data input, for use across
# my functions, does anyone know how to fix this please? many Thanks.
confUser = input("re-input your username: ")
confPassWd = input("re-input your password: ")
if confUser == user and confPassWd == passWd:
print ("Your username and/or password was incorrect")
print ("Welcome "+ user)
print ("You have successfully logged in!")
command = input("Enter your command: ")
if command == "log off" or command == "quit":
username = ""
password = ""
print ("You have logged off")
print ("Unknown command")