0

Can't Understand a Part?

I am new and currently at Pythan Boolean-Logic part. In this code: if not True: print("1") elif not (1 + 1 == 3): print("2") else: print("3") I cannot understand what this part does: if not True: print("1") Please Explain this part??

10th Feb 2020, 4:20 PM
Mayank Soni
Mayank Soni - avatar
3 odpowiedzi
+ 3
not True means False. if False: print("1") #This never runs because the condition is False so we jump to the elif part elif not (1+1==3): print("2") 1+1==3 is False and not False is True. That's why 2 is printed out.
10th Feb 2020, 4:33 PM
Kevin ★
+ 2
not True means false. Can you share your full code?
10th Feb 2020, 4:25 PM
A͢J
A͢J - avatar
0
It is same than in speech: not True ---> False not False ---> True Because boolean can only have 2 different values knowing whether a boolean is not true or false would mean that the boolean must be the another possible value. In speech this would not work for other types of values, a number not 10, could be 5, 4 or any but not 10.
10th Feb 2020, 5:06 PM
Seb TheS
Seb TheS - avatar