Quick question regarding a Boolean operation: If I want to establish the condition that R!= #1 or #2 or #3...etc. What would be the syntax for that? I tried to do R!= (a or b or c or d) but seems like that's completely wrong... Could somebody please help me? Thank you!
not sure what you mean by "establish the condition" ... maybe assert? and it's just style, but R! is a horrible name for anything, lose the punctuation if you are checking a condition, (a or b or c or d) is perfectly valid but if you don't like that, and you have sets to play, try R in [a,b,c,d]
Hi philips13: Thanks for responding. What I meant is that I want to write a code that says 'R does not equal to a or b or c or d'. So would "R != a or b or c or d" work?
Yes, but be careful and check the truth table. Do you want to make sure they are all false? If so, that's it. and another style point: If this check is only used once, there is no need to set a variable, and it usually makes it a lot more readable and easier to maintain. while not (a or b or c or d) ... if not (a or b or c or d) ... return not (a or b or c or d) ...
yes, I forgot this was Python, tried to stay generic
Join our real-time social learning platform and learn together with your friends!