I am here, in this lesson, on this course page.
For REFERENCE, as per the course material:
statement_two = not (8 * 2) != 20 - 4
I was playing around with the example code to try to undertand the material better and am getting mixed results. Can anybody explain what’s going on here because what I am seeing is to making any sense to me!!!
This conditional doesn’t print anything. Why? (My thinking is it should print SOMETHING, because it can not be neither, it HAS to be one or the other. So then why is it not printing ANYTHING? )
if statement_two:
print("true")
else:
print("false")
While THIS if statement
written DIRECTLY below the one above, DOES print, and prints false
! Why? (My thinking is that both the first if statement
above and the one below ask the same thing, if statement two is true then print something. If that is the case then why is only the second one printing something. I am asking if statement two is true, the second if statement
is saying it is true (because it printed something) and is printing false
as a string.
The first one is saying it is not true by not printing anything - ie skipping it, so then in the first set of if statements
the else
should be printing…I don’t know what is going on here!! Somebody Please Help!!)
if statement_two:
print("false")
Adding == True:
to all of them like if statement_two == True:
(True without quotes as a boolean) doesn’t change anything. It exhibits the exact same behavior as above.
Aren’t
if statement_two:
and
if statement_two == True:
Saying the same exact thing?
Also, aren’t
not 1 + 1 = 2
and
1 + 1 != 2
Saying the exact same thing??
Thank you to anyone who responds, in advance!!