I am just a beginner programmer as of right now, and I am trying to create a username/password program. Here is my code below:
username = 'Polly1220'
password = 'Bob'
userInput = input("What is your username?\n")
if userInput == username:
a=input("Password?\n")
if a == password:
print("Welcome!")
else:
print("That is the wrong password.")
else:
print("That is the wrong username.")
Whenever I run my program and input the correct password as shown, it always says that the password is incorrect.
You need to assign the second input statement to userInput:
if userInput == username:
userInput = input("Password?\n")
if userInput == password:
print("Welcome!")
else:
print("That is the wrong password.")
else:
print("That is the wrong username.")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With