if/else statements

if statements have multiple ways that we can customize them (other than changing the logical expression): the first of these ways is by adding an else clause to our statement.

The syntax of if/else statements is:

if logical_expression:
    # do something
else:
    # do something different
# TODO: run me! Under what circumstances is "big number" printed out?
# What about "small number"?
# Answer:

number = int(input("number? "))

if number > 100:
    print("big number")
else:
    print("small number")
    
print("done")

Notice that what makes this statement different than in the previous section is that either “big number” or “small number” is always printed. After one of the two is printed, then we finish by printing “done”.

We can think of this as a fork in the road that has a left and right option for paths that then rejoin each other.

if/else statement as a flowchart

# TODO: write your own if/else statement here!