0
I don't understand for this code, first line makes me confused, can anyone help me for understanding this section? Thx.
7 Antworten
+ 4
The truth is that they did a terrible job explaining how if else statements work. Only the statements that result in true will be executed. Since the first line says "if NOT True:" equals false, since false is the definition of not true, then the Print 1 line will not be executed. It would be the same if they said "if false:" instead. You would not Print 1 since that if statement is false. You would move on to the first else statement.
+ 2
If Not True:
I also think the code above is confusing.
Let's solve this like a math problem ...
If Not (6+2)/4>1 :
If Not (8)/4>1 : 'replaced 6+2 with 8
If Not 2>1 : 'replaced 8/4 with 2
If Not True : 'replaced 2>1 with True
"If" logic is satisfied by true statements
"If Not" logic is satisfied by false statements
True is a true statement,
and does not satisfy the "If Not" logic --
so the code after "If Not True:" won't be run.
+ 1
In Boolean logic section..
A condition is checked with either True or False as output...
For Example :
4==2+2 returns True
Where as 4==2+3 returns False
Similarly, <,>,<=,>=,<>,etc are other relational operators which returns True or False..
And there are mainly 3 logical operators
and, or, not
---------
X------Y-------X and Y
False--False--False
False--True---False
True---True---False
True---True---True
X------Y-------X or Y
False--False--False
False--True---True
True---True---True
True---True---True
X------not X
False--True
True---False
+ 1
very simple
(and operator)1. if the both statements are right than it is true
(or operator)2 if one statement is right and other is false than it is true
0
Where is the code?
0
the code is from questions of boolean-logic
0
brother yusuf plz solve the whole problem with coding i shall also then my code