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)
5 Réponses
+ 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
Line 8 :
print( 3 < 3 or 6 !=7) is true because,in plain english, 6 is not equal to 7 and that's true.