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")

10th Aug 2019, 11:37 AM
Sam Hardy
Sam Hardy - avatar
2 Answers
+ 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 šŸ˜‰
10th Aug 2019, 11:43 AM
Matthias
Matthias - avatar
+ 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.
10th Aug 2019, 11:44 AM
Sam Hardy
Sam Hardy - avatar