i dont get this question sololearn asks me, i would like to know why | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

i dont get this question sololearn asks me, i would like to know why

if not True: print("1") elif not (1 + 1 == 3): print("2") else: print("3")

26th Dec 2021, 4:32 PM
kirkland water bottle
kirkland water bottle - avatar
2 Answers
+ 2
If not True = False Elif not (1+1==3) = elif not (False) = True That Prints 2
26th Dec 2021, 4:37 PM
CGM
CGM - avatar
+ 1
As Christian said: The first check (if not True) results as false, so that option doesn't get used. The second check (elif not(1+1=3)) results as false(false) so becomes true. Runs that option to print 2. Third option doesn't get checked because second option was used.
26th Dec 2021, 10:15 PM
HungryTradie
HungryTradie - avatar