The way that programs make decisions is called **control flow**.
The most common way to make decisions is with an `if` statement.
An `if` statement only runs code if a certain `condition` is true.
For example, your condition could only make fun of people whoare older than, like, arbitrarily, 28 years old.
```python
if age > 28:
print('Unc alert!!')
```
You might also want to run some code if the condition is not true.
```python
if age > 18:
print("Hey, you can vote!")
else:
print("Hah, you're a child.")
```
You might also find yourself in a situation where you need a few more options than `if` and `else`.
In that case, you probably want to say something like "if this ..., else if this ..., else if this ..., or if all of those are false do this." Us coders call that "else if" but we're also lazy, so in Python we call it `elif`.
```python
if age > 65:
print("Bruh, you're literally a dinosaur")
elif age > 40:
print("Please stop asking me how to use your phone")
elif age > 28:
print("Unc status")
elif age == 28:
print("Nice. You're literally the perfect age")
elif age > 18:
print("Hey, since you can vote, can we get some more bike lanes?")
else:
print("What's your favorite food? Apple sauce or milk?")
```
> [!WARNING] WARNING! WARNING! WARNING!
> Look out! "Else if" only gets checked if the statement before it fails.
> You're probably gonna do something silly at some point like this:
> ```python
> if grade > 85:
> print("You're Proficient!")
> elif grade >= 100:
> print("You're Excel!")
> else:
> print("NYP. Booooo")
> ```
> This program will never notice you're Excel, because it checks if you're Proficient first.
## instructions
**Challenge 1**
In chemistry, pH is a scale that measures how acidic something is. It goes from 0 to 14. Anything less than 7 is acidic. Anything above 7 is basic. If a solution is 7 exactly, it's neutral.
> Create a program that takes in a pH value and tells you if it's acidic, basic, or neutral.
---
**Challenge 2**
It will be useful to get a random number for this one. You can do that like this:
```python
import random # this line has to be at the top of your file
number = random.randint(1, 100) # generates a random number between 1 and 100
```
> Create a magic 8 ball program that takes in a yes or no question and gives you a random answer.
> Your program should have 9 possible ansers: 3 ways to say yes, 3 ways to say no, and 3 ways to say it's not sure
> It should output something like this:
> ```plaintext
> Question: [question]
> Magic 8 Ball: [answer]
---
**Challenge 3**
When you're creating an if statement, you can check multiple conditions at once like this:
```python
if age > 12 and age < 20:
print("You're a teenager")
```
> Create a program that determines if a person is allowed to get on a rollercoaster.
> You must be at least 5' tall and have 10 credits to ride the coaster.
> Ask the person their height and how many credits they have, and give them a message telling them *why* they can or cannot get on the ride.