Python Forum
Thread Rating:
  • 2 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I need help with my code!
#1
i was trying to make a code that would ask me to register my email username and password.
the register part on this code goes well... but i have one issue on the login part..
When i put different  Email/Username or password as i registered it will still count it as correct.
i want it to work like this: I register then i put the same details i used in register section it will count as correct.
But if i put different details than the ones i used in register section i want it to count as incorrect.

Another a little smaller issue is that i cannot figure out how to stop the command going when i put wrong password, username or email... or ask person to input the password/username/email again.

print ("Please register your new account!")

Email = input ("What is your Email address? : " )

print ("You are using Email account known as: " + Email)

Username = input ("What should we call you? : " )

print ("Okay " + Username)
Password = input ("What password do you wish to use? : " )

print ("Okay " + Username)
print ("You are registered with Email " + Email)
print ("And your password is " + Password)

Email = Email
Username = Username
Password = Password

print ("Please login to your account to continue")

Email = input ("Please enter your Email address : " )

if Email == Email:
   print ("Correct email please proceed to the username")
else:
   print ("This email is not yet registered with us! please try again.")

Username = input ("Please enter your Username : " )

if Username == Username:
   print ("please proceed to the Password")
else:
   print ("This username does not exist please try again")

Password = input ("Please enter your password : " )

if Password == Password:
   print ("Welcome back " + Username)
else:
   print ("Incorrect password! Please try again!")
Thank you for reading and taking your time to help me solve the issues !!
Reply
#2
You need to use different variable names. You're re-using them, and overwriting the previous vaues.
Reply
#3
(May-15-2017, 04:59 PM)TheSpalekUk Wrote: if Password == Password:
Why not just do if True:? It's the same thing, and less confusing to someone reading it :p
Reply
#4
(May-15-2017, 05:12 PM)micseydel Wrote: You need to use different variable names. You're re-using them, and overwriting the previous vaues.

Thanks !! You are a life saver !!!
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020