My testing for string equality within a function is always returning true despite meeting other conditions https://code.sololearn.com/cc5Qhh0SW7eF/?ref=app
1/21/2020 2:39:23 PM
ren[paused]3 Answers
New AnswerYour condition is wrong. if "y" or "Y" == sc: This is always True because "y" is evaluated as True (non-empty string). To fix it use another comparison operator like: if "y" == sc or "Y" == sc: or you can simplify like this: if sc in "yY":
if "y" or "Y"== enable_spaces: should be if "y" == enable_spaces or "Y" == enable_spaces: or if you are willing to lowercase before checking, if enable_spaces.lower() == "y":
I'm starting to see now thank you :) I like some of the option- I guess I forgot to be explicit with the if statement
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message