Advertisement Jump to content
Sign in to follow this  
jordi_0071

or operation in python?

This topic is 4980 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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!