I'm wanting to have a "y/n" in Python, which i've successfully done, but I want the user to be able to input a "y" or a "Y" and it accepts both.
Here's a short if statement
if yn == "y":
break
I'm wanting to make it be something like this
if yn == "y" || "Y":
break
But "||" is the OR operator in Java. I don't know what the OR operator is in Python or if I could even use it for something like this. Any help?
You're looking for
if yn in ("y", "Y"):
Or better:
if yn.lower() == 'y':
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With