0
I do not understand why this output is given. Can anyone explain it to me?
I was doing a challenge and given this question: if 4%2: print (0) else: print (1) what is the output? I thought since 4%2=0 that it would evaluate to True so it would print 0. But the answer was 1. Can someone explain this to me? I haven't been able to find anything to help me understand it. Thank you in advance!
1 Resposta
+ 1
0 = False or rather
False has a value of 0 so the result is False and the else statement is ran.
Try replacing 4%2 with just a 0 then try with 1 or some other number than 0.