0

Please why did my 3rd argument output 2

https://code.sololearn.com/ciTHK9M8M2d8/?ref=app

19th Jun 2020, 3:13 PM
Maryam Bello
Maryam Bello - avatar
6 Antworten
+ 3
Maryam Bello lines inside the *if* statement is executed only and only when the condition is true. Thus "if true" will always pass as the condition is always true.
20th Jun 2020, 12:29 AM
Arsenic
Arsenic - avatar
+ 4
1+1==3 is False and not False is true,so you get 2
19th Jun 2020, 3:21 PM
Abhay
Abhay - avatar
+ 4
In your attempts you are writing >>> if not false Which is nothing but true so hence "1" is printed and control is never passed to elif/else
19th Jun 2020, 3:24 PM
Arsenic
Arsenic - avatar
+ 3
Maryam Bello just break it line by line if not True: #which is false so the control goes to elif print ("1") elif not (1+1== 3): # (2==3) is false and *not* falso is true hence "2" is printed print("2") else: print("3")
19th Jun 2020, 3:23 PM
Arsenic
Arsenic - avatar
+ 1
Thank you. So what you mean is if not false: which means - if true: will always be passed when in argument?
19th Jun 2020, 8:21 PM
Maryam Bello
Maryam Bello - avatar
19th Jun 2020, 8:21 PM
Maryam Bello
Maryam Bello - avatar