Table of contents
- if / else
- Comparison Operators
- Nested if / else
- if / elif / else
- Multiple if
- Logical Operators
- Day 3 Project: Treasure Island
- 三元運算子
if / else
if condition:
do this (condition is True)
else:
do this (condition is False)

print("Welcome to the rollercoaster!")
height = int(input("What is your height in cm? "))
if height >= 120:
print("You can ride the rollercoaster!")
else:
print("Sorry, you have to grow taller before you can ride.")
Comparison Operators

#Exercise 3-1
number = int(input("Which number do you want to check? "))
if number % 2 == 0:
print("This is an even number.")
else:
print("This is an odd number.")
Nested if / else
if condition:
if another condition:
do this
else:
do this
else:
do this

if height >= 120:
print("You can ride the rollercoaster!")
age = int(input("What is your age? "))
if age <= 18:
print("Please pay $7.")
else:
print("Please pay $12.")
else:
print("Sorry, you have to grow taller before you can ride.")
if / elif / else