Today we teach Python what to do when a condition is False.
if condition:
print("YES")
else:
print("NO")
age = int(input("Enter age: "))
if age >= 18:
print("Eligible")
else:
print("Not eligible")
"Even", else print
"Odd".
This is how Python thinks internally. The highlighted path shows what happens for your input.
Output will appear here…
Name: ____________ Date: ____________
Q1. What does if do?
Q2. What does else do?
Q3. True/False: 5 % 2 == 0
Q4. Write a program to check even or odd.
Write a simple if–else. We will convert it into a decision
tree.