if statements not working correctly, please help
all it does is prints
form the quit message in the first if statement.
Is it something from the with open(file)... thing?
@Ravost I can help! You need to understand the proper use of the
or in Python.
If you look at
if message.lower() == "quit" or "exit":, it would be re-syntaxed like this:
if (message.lower() == "quit") or "exit":
Which "exit" would return True (un-boolean things return True unless for
1) no matter what, which would result in the whole if statement returning True because you used
or. So, to fix it, you do:
if (message.lower() == "quit") or (message.lower() == "exit"):
Which would be the correct solution. Hope this helps, and hope you can mark it as answered!