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
MIT 6.189 A Gentle Introduction to Programming Using Python (OCW)
Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
You 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
Without 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)
I 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.
Not the answer you are looking for? Search for more explanations.
Idle 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 or (True and False)
>>> (True or True) and False
>>> False and False or True
>>> (False and False) or True
>>> False and (False or True)
The 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?
without parentheses, the precedence can be judged with 'NAO' (not , and , or)
in 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 :)