01if, elif, else
main.py
score = 72
if score >= 90:
print("A")
elif score >= 70:
print("B")
else:
print("C")Output
B
Python conditional statements: if, elif, else, ternary expressions, comparison operators, and the match statement for control flow.
score = 72
if score >= 90:
print("A")
elif score >= 70:
print("B")
else:
print("C")B
age = 20
status = "adult" if age >= 18 else "minor"
print(status)adult
a, b = 5, 10
print(a < b and b < 20)
print(a > b or b > 5)
print(not a == b)True True True
fruits = ["apple", "banana"]
print("apple" in fruits)
print("cherry" not in fruits)True True
command = "start"
match command:
case "start":
print("Starting")
case "stop":
print("Stopping")
case _:
print("Unknown")Starting