+ 1

What is the output of this question? Y isnt it 7?

num=7 if num>3: print ("3") if num<5: print ("5") if num==7: print ("7")

7th May 2020, 7:15 AM
AMRUTHA B R
3 Antworten
7th May 2020, 7:31 AM
Abhay
Abhay - avatar
+ 2
37 becoz elif is not used so all conditions are check for true or false i.e., 1st and 3rd condition is true so output will be 3 7 not 37 it will include breaks (enter)
7th May 2020, 7:16 AM
Abhay
Abhay - avatar
0
But i obtained the ans to be 3..not both 3&7
7th May 2020, 7:19 AM
AMRUTHA B R