if / elif / else
Practice
Classify a number
Bank apps label transactions: money in (+), money out (−), or exactly zero. Your program reads one integer and prints Positive, Negative, or Zero.
Picture this: sign of a number
Compare n to zero, then pick a label.
nthe number
→
n > 0?if
→
n < 0?elif
→
else 0zero
Diagram — sign check
In easy words: What is this task?
You check whether a number is above zero, below zero, or exactly zero, then print the matching label.
Where this is used
Used in finance (profit/loss), sensor readings, temperature classification, and directional math values.
Real world: thermometer reading
Weather APIs classify temperature relative to 0°C. Above zero → warming trend label; below → cold alert; exactly 0 → freezing point warning.
1n = 0
2if n > 0:
3print("Positive")
4elif n < 0:
5print("Negative")
6else:
7print("Zero")
Zero
1n = int(input())
2if n > 0: print("Positive")
3elif n < 0: print("Negative")
4else: print("Zero")