A community for students. Sign up today!
Here's the question you clicked on:
 0 viewing
 2 years ago
is "True or True and False" the same as "(True or True) and False" which is False or "True or (True and False)" which is True? here, the quotes i type mean general code
 2 years ago
is "True or True and False" the same as "(True or True) and False" which is False or "True or (True and False)" which is True? here, the quotes i type mean general code

This Question is Open

msmithhnova
 2 years ago
Best ResponseYou've already chosen the best response.0You could type it into the Python shell and it would tell you ... But by order of operations AND is processed before OR without brackets. See this link http://www.informit.com/articles/article.aspx?p=459269&seqNum=11

Patapom
 2 years ago
Best ResponseYou've already chosen the best response.0Without parentheses to clarify, this would evaluate as "True or (True and False)" = True. "and" evaluating first... (as far as I know in C, C++, C#, JS and Java)

KonradZuse
 2 years ago
Best ResponseYou've already chosen the best response.1I don't think it checks && or  first, I believe it goes based on what is read first. Make a Truth Table and see how it goes.

msmithhnova
 2 years ago
Best ResponseYou've already chosen the best response.0Idle output below, as you can see in both cases with "and" before "or" or "and" after "or" it is equivalent to putting brackets around the "and" part meaning it is processed first. >>> True or True and False True >>> True or (True and False) True >>> (True or True) and False False >>> False and False or True True >>> (False and False) or True True >>> False and (False or True) False

KonradZuse
 2 years ago
Best ResponseYou've already chosen the best response.1The thingj is, he said he's using "General code." I think this is more of an example of Digital Electronics. ANDS, NOTS, ORS, NORS, XOR, etc. The thing is what are the variables? What is true, and what is false? 1 variable? 2?

ArunS07
 2 years ago
Best ResponseYou've already chosen the best response.1without parentheses, the precedence can be judged with 'NAO' (not , and , or)

amine2206
 2 years ago
Best ResponseYou've already chosen the best response.0in any programming language there is precedence of operators (which one must be evaluated at first) , so just check the precedence and you'll get your answer :)
Ask your own question
Ask a QuestionFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.