Why is line 8 true | Sololearn: Learn to code for FREE!

0

# Why is line 8 true

print(1 == 1 or 2 == 2) print(1 == 1 or 2 == 3) print(1 != 1 or 2 == 2) print(2 < 1 or 3 > 6) print(3 < 3 or 6 != 7)

12/2/2018 9:00:25 PM

Jordan Autrey

7 Answers

New Answer

+4

Jordan Autrey I believe you want to know how to make it so false is printed if one of the expressions is false. If so, replace the "or" operator with the "and" operator. See differences below: print(false or true) # outputs true print(false and true) # outputs false With "or", only one of the expressions has to be true to return true. With "and", both expressions must be true to return true.

+1

The sign != is "not equal"

0

Correct? So it must match how line 5 is coded? So I can't ask a question like line8?

0

Thanks Jamie so what would I have to use inorder to run line 8 with out any errors could you create an example for me please. I'm like only one week into Python with udemy and still don't fully understand when and why you can't do and do certain things yet like this

0

Line 8 : print( 3 < 3 or 6 !=7) is true because,in plain english, 6 is not equal to 7 and that's true.