0

what??

num= 7 if num>5: print("ok") if num==7 print("šŸ‘Œ") why is ok correct??

12th Nov 2017, 2:59 PM
Login s
Login s - avatar
4 Answers
+ 10
The correct code will be something like this... num= 7 if num>5: print("ok") if num==7: print("7") #use any string or no. instead of 7 The šŸ‘Œ u used cannot be printed in SL... Output: #ok #7
12th Nov 2017, 3:30 PM
Frost
Frost - avatar
+ 2
because num is more than 5. so the following condition is executed.
12th Nov 2017, 3:07 PM
shobhit
shobhit - avatar
+ 1
this due to precedence because first condition is true it prints ok now i think it never reach to the next condition but i think that would happen when you use a elif condition. i dont know python a lot, but generally i think its because of the precednce of conditions.
12th Nov 2017, 3:16 PM
shobhit
shobhit - avatar
0
th numb is also 7 i mean num==7 is true isn't it?
12th Nov 2017, 3:11 PM
Login s
Login s - avatar