+ 1

if statement problem ... Help !

it's a simple login script requires multiple input so you might need to try it on your local terminal (if there's a way to compile it on the website please let me know) the main problem is with the if statement "you'll find a comment over it" the program enters the if statement even when the condition is false ???? i'm new to python https://code.sololearn.com/cG9ha058nNHY

9th Apr 2020, 4:19 PM
Taha Reeh
Taha Reeh - avatar
2 Answers
+ 6
What i found is an issue in the RegToBool() function: def RegToBool(Answer): if Answer == "Y" or "y": # should be: if Answer == "Y" or Answer == "y" print(f'regtobool {Answer}') return True elif Answer == "N" or "n": # should be: elif Answer == "N" or Answer == "n": # or better do something like this: if Answer.lower() == "y": elif Answer.lower() == "n":
9th Apr 2020, 7:23 PM
Lothar
Lothar - avatar
+ 1
Lothar this was really helpful, thanks alot man 👍
12th Apr 2020, 5:00 PM
Taha Reeh
Taha Reeh - avatar