Can anyone explain in detail about Boolean logic - not | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Can anyone explain in detail about Boolean logic - not

15th Mar 2019, 6:05 PM
Dileep Patcha
Dileep Patcha - avatar
6 Answers
+ 6
There are a couple of boolean operators, which you use to create boolean expressions, which the evaluate to true or false. Before getting into them, let's establish the following: if(5>4) This expression evaluates to true Now then, boolean operators. Remember that they "link" two expressions or more They are: (will use C- like languages) 1. AND operator ( && ) Both inputs must be true Example if( 5>4 AND 6<8) This evaluates to true, bcs both conditions are met. if( 4+5<=10 && 1-1==1 ) This evaluates to false, even though one is true, the other one is false. 2. OR operator || Only one of the inputs must be true. The example above return true if we replace && with || Another ex: a=3; b=5; if(a<b || a+b==8) Evaluates to true, only one must be true, in this case both, that does not influence the result 3. The "NOT" operator ( ! ) Flips everything if( !(1+1=2)) Evaluates to true at first, but ! negates it and turns it to false. if(!("a"=="A")) Evaluates to false at first, then true because of the !
15th Mar 2019, 10:00 PM
Demon
Demon - avatar
+ 6
// In computing, a "NOT" portal is a inversor in which we reverse the booleans, For example: 1 (start) => 0 (arrival) 0 (start) => 1 (arrival)
15th Mar 2019, 7:39 PM
program
program - avatar
+ 4
In Python, a boolean expression returns either True or False. So what is 'not True'? False. And what is 'not False'? True. 5>4 -> True not 5>4 -> False
15th Mar 2019, 7:47 PM
HonFu
HonFu - avatar
+ 2
To understand Boolean logic I recommend you take a course in mathematics called Boolean Algebra Where you will learning of the various logic gate and their output but is a demo The Logical AND gate Rules state if all is on it is on AND gate true table A|B|output 1 1 0 1 0 0 0 1 0 0 0 0 Where 0 means off and one means on Logical NOT gate rule state State if one input is off the output will be on the NAND gate and many other as you learn you will understand their true and become a master of boolean Logic
16th Mar 2019, 8:35 AM
George S Mulbah II
George S Mulbah II - avatar
0
Not operator is nothing if the statement is correct then the result is False and if it is wrong then the result is True
2nd Apr 2019, 2:32 AM
Thilak
0
It checks on the things you defined Just for example a=1 b=2 a!=b (a not equals to b it returns true if the condition is true thats is 1 not equals to 2)
3rd Apr 2019, 5:04 AM
Tony Stark
Tony Stark - avatar