0

I'm getting output as " no output"??? whyy

num = 76 if num < 5: print("Bigger than 5") if num <=47: print("Between 5 and 47") else: print("fghhjffg")

20th Nov 2016, 7:36 PM
Zameer shaikh
Zameer shaikh - avatar
7 odpowiedzi
+ 2
if num < 5: seems to be the cause if num > 5: this should be the right one you are messing up comparison
20th Nov 2016, 7:50 PM
asdadasdsaczxc
+ 1
your condition is the other way around itself 76 is bigger than 5, so your condition num < 5 is False. so the rest doesnt execute. the interpreter will print "no output"
20th Nov 2016, 7:52 PM
asdadasdsaczxc
+ 1
if the first 'if' is False, anything within that 'if' block will not execute. it's False, so when the interpreter online executes your code it will print "no output" to tell you that the code finished with no output.
20th Nov 2016, 8:00 PM
asdadasdsaczxc
0
first if condition is correct then it ll go to further of the if conditions. but 1st if condition fails thn further if conditions ll not check . I'm lil bit confused .is my assumption is correct or wrong
20th Nov 2016, 7:48 PM
Zameer shaikh
Zameer shaikh - avatar
0
so by this 2nd if s under 1st if so it's not executing
20th Nov 2016, 7:57 PM
Zameer shaikh
Zameer shaikh - avatar
0
hmmm tq brother😊 for clearing
20th Nov 2016, 8:03 PM
Zameer shaikh
Zameer shaikh - avatar
0
it's ok👍 next time
20th Nov 2016, 8:15 PM
Zameer shaikh
Zameer shaikh - avatar