0

Output : no output

If I put a number less than or 12, it says no output. I’m not sure what I’m doing wrong. Please help :/ This Is the code: a = int(input()) if a>12: print("number is bigger than 12") if a<12: print("number is smaller than 12") if a==12: print("number is 12")

8/10/2019 11:37:16 AM

Sam Hardy

2 Answers

New Answer

+2

You need to align the other ifs on the same height as the first if (and use elif for them). The way your ifs are aligned now doesn't make sense, since you could only enter them if the first if returns true. But of course a number less than 12 can't be bigger than 12 😉

+2

i actually discovered myself that i need to remove the indentations for the second and third if/statements. for nested if, if the first statement is false, it would not proceed to the next statement. thought id leave this here for others who made the same mistake i did.