Jump to content
  • Advertisement
Sign in to follow this  

or operation in python?

This topic is 4737 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
hehe didn't know it was that simple:P but if i do this:

if YN != "Y" or "y" or "N" or "n":
print "Not a valid option"



it doesnt work. what's wrong with it?

Share this post


Link to post
Share on other sites
Quote:
Original post by jordi_0071
cant you use the !=?


Yes, but not in that way. You would need to do this:

if YN != "N" or YN != "n" or YN != "Y" or YN != "y"

But python is a great language and has many more expressive ways to do things:

if YN not in ("Y", "y", "N", "n"):

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!