0

Does the first if statment take priority on the innerbones?

28th Feb 2019, 7:31 PM
Maroun Rizk
Maroun Rizk - avatar
3 Respuestas
+ 1
x=4 if x < 5: print("5") if x < 8: print("8") # Output: 5 8 x=4 if x > 5: print("5") if x < 8: print("8") # No output In the second code the condition x>5 is False and so the statement under "if x<8:" is never executed.
28th Feb 2019, 8:55 PM
Diego
Diego - avatar
0
x=4 if x < 5: print("5") if x <8: print("8")
28th Feb 2019, 8:38 PM
Maroun Rizk
Maroun Rizk - avatar
0
Both are correct what deos its print?
28th Feb 2019, 8:39 PM
Maroun Rizk
Maroun Rizk - avatar