"""
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
 - Debug logical errors by using the scientific method
"""

x = 400
if x < 10:
    print("Single digit")
    print("assuming it's positive")
elif x < 100:
    print("in between")
else:
    print("more than one digit")
print("this is always shown")

#####

def gradeCalculator(grade):
    if grade >= 90:
        print("A")
    elif grade >= 80:
        print("B")
    elif grade >= 70:
        print("C")
    elif grade >= 60:
        print("D")
    else:
        print("R")

gradeCalculator(88)

#####

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()