0

whats the problem?

my goal is to enter the password and if its incorrect it gives me another try... and if its true it stopes and says well done. code: Pass = "yahel120" def trypass(): my_input = input ("whats the password?\n").lower() while Pass != trypass(): #while the password is incorrect - it runs this code again and again: trypass() if trypass() == Pass: #if the password is correct it runs this: print ("well done")

10th Jun 2020, 12:40 PM
Yahel
Yahel - avatar
4 odpowiedzi
+ 2
You need to return my_input from your trypass() function. Then you can actually do: while Pass != trypass(): print("Wrong, try again") print("Well done.")
10th Jun 2020, 1:08 PM
Russ
Russ - avatar
+ 1
You are taking input in my_input variable and checking with trypass function
10th Jun 2020, 12:42 PM
Hardik Sharma
Hardik Sharma - avatar
+ 1
my_input == Pass instead of trypass() == Pass
10th Jun 2020, 12:48 PM
Hardik Sharma
Hardik Sharma - avatar
0
Hardik Sharma , how is the code goin to look?
10th Jun 2020, 12:45 PM
Yahel
Yahel - avatar