Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

lowsypunk

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

  • one year ago
  • one year ago

  • This Question is Open
  1. msmithhnova
    Best Response
    You've already chosen the best response.
    Medals 0

    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

    • one year ago
  2. Patapom
    Best Response
    You've already chosen the best response.
    Medals 0

    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)

    • one year ago
  3. KonradZuse
    Best Response
    You've already chosen the best response.
    Medals 1

    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.

    • one year ago
  4. msmithhnova
    Best Response
    You've already chosen the best response.
    Medals 0

    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 >>> 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

    • one year ago
  5. KonradZuse
    Best Response
    You've already chosen the best response.
    Medals 1

    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?

    • one year ago
  6. ArunS07
    Best Response
    You've already chosen the best response.
    Medals 1

    without parentheses, the precedence can be judged with 'NAO' (not , and , or)

    • one year ago
  7. amine2206
    Best Response
    You've already chosen the best response.
    Medals 0

    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 :)

    • one year ago
    • Attachments:

See more questions >>>

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
  • 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.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.