I don't understand for this code, first line makes me confused, can anyone help me for understanding this section? Thx. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I don't understand for this code, first line makes me confused, can anyone help me for understanding this section? Thx.

29th Jul 2016, 4:00 AM
yusuf atw
yusuf atw - avatar
7 Answers
+ 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.
5th Aug 2016, 2:21 PM
Brett Dent
Brett Dent - avatar
+ 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.
31st Jul 2016, 7:50 PM
CowsEatGrass
CowsEatGrass - avatar
+ 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
29th Jul 2016, 7:42 AM
Prashant Shahi
Prashant Shahi - avatar
+ 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
3rd Aug 2016, 4:10 PM
shawn frost
shawn frost - avatar
0
Where is the code?
29th Jul 2016, 5:09 AM
Benneth Yankey
Benneth Yankey - avatar
0
the code is from questions of boolean-logic
29th Jul 2016, 5:54 AM
yusuf atw
yusuf atw - avatar
0
brother yusuf plz solve the whole problem with coding i shall also then my code
23rd Sep 2016, 4:02 AM
Ahmed Kamal
Ahmed Kamal - avatar