dogtotom
New Member
Veteran
hello i am Thomas and i like my D0G
Posts: 6
ROBLOX Username: dogtotom
|
Post by dogtotom on May 3, 2017 11:09:05 GMT
username = ("1") #("mrleeman")
password = ("1") #("Leeman123")
user = ("incorrect")
INusername = input("please enter username : ")
if not INusername == username:
print ("invalid username")
if INusername == username:
INpassword = input("please enter password : ")
if not INpassword == password:
print ("invalid password")
if INpassword == password:
print ("Loading...")
user = ("correct")
choice1 = input(" 1 = Students 2 = Beheavior points 3 = Registor please choose :")
# students name gender and age
if choice1 == 1
i want to turn the middle section into a loop which keeps on looping if you get the password or username wrong (i know its quite easy but i`m learning at the minute)
|
|
|
Post by Josh on May 3, 2017 11:17:43 GMT
You should make use of a while loop. It should keep iterating until the password is correct before continuing. Try to use subroutines to make your code a bit cleaner. For example: inputtedpass = input('Pass: ') while inputtedpass != password: inputtedpass = input('Incorrect!\nPass: ')
login() You can learn more about Python while loops here.
|
|
|
Post by Josh on May 3, 2017 16:51:49 GMT
You should also note that your current program logic lets you login if the password is correct, regardless of the username.
|
|