+ 2

thats so strange!!

i tried this code but the result is "no output". but why? x = 30 if x < 30: print ("bye") if x >= 30: print ("Hi") thanks a lot

7th Dec 2017, 9:04 AM
Yusuf Nazari
Yusuf Nazari - avatar
3 Réponses
+ 1
thanks to Niush sitaula but the sample of sololearn is like this completely and the result is ok . that is: num = 12 if num > 5: print("Bigger than 5") if num <=47: print("Between 5 and 47")
7th Dec 2017, 9:16 AM
Yusuf Nazari
Yusuf Nazari - avatar
+ 1
That's 2 diffrent codes... sololearn examle start with bigger the 5, then smaller then 47. You go for bigger then 30 and then lower/equal to 30. test the sololearn code with num = 4 and you will get the same result "No Output" test yours code with x = 70
7th Dec 2017, 9:23 AM
Amir Galanty
Amir Galanty - avatar
+ 1
thank you amir. I found a soloution in next course, that is "else": x = 30 if x < 30: print ("bye") else: if x >= 30: print ("Hi") but thats very important to use "<=" or ">=" in one of them to define the number 30. thanks to all
7th Dec 2017, 11:47 AM
Yusuf Nazari
Yusuf Nazari - avatar