"""
Learning Goals:
 - Use logical operators on Booleans to compute whether an expression is True or False
 - Use conditionals when reading and writing algorithms that make choices based on data
 - Use nesting of control structures to create complex control flow
 - Use nesting of control structures to create complex control flow
 - Debug logical errors by using the scientific method
"""

x = 42

print("hello")
if x < 10:
    print("wahoo!")
elif x <= 99:
    print("meh")
else:
    print("ruh roh")
print("goodbye")

###

x = 69
if x >= 90:
    print("A")
elif 80 <= x:
    print("B")
elif x >= 70:
    print("C")
elif x >= 60:
    print("D")
else:
    print("R")

###

x = "4"
y = 10
if type(x) == type(y) and x < y:
    print("Smaller:", x)

###

age = 31
license = False
if age >= 26:
    if license == True:
        print("Rental Approved")
    else:
        print("Rental Denied")
else:
    print("Rental Denied")

# or

if age >= 26 and license == True:
    print("Rental Approved")
else:
    print("Rental Denied")

###

first = True
second = False

if first == True:
    if second == True:
        print("both true!")
    else:
        print('uh oh')
else:
    print("first not true")

###

def findAverage(total, n):
    if n <= 0:
        return "Cannot compute the average"
    return total / n

###

numLegs = 0
wagsTail = True
if numLegs != 4:
    print("It's a fish")
elif wagsTail == True:
    print("It's a dog")
else:
    print("It's a cat")
print("What a good pet!")

###

def findAverage(total, n):
   if n <= 0:
       return "Cannot compute the average"
   return total // n

def testFindAverage():
    print("Testing findAverage()...", end="")
    assert(findAverage(20, 4) == 5)
    assert(findAverage(13, 2) == 6.5)
    assert(findAverage(10, 0) == "Cannot compute the average")
    print("... done!")

testFindAverage()
