"""Just Weight and See
Great! Now we need to compute a student’s average using weighted averages.

cost = {
    "apples": [3.5, 2.4, 2.3],
    "bananas": [1.2, 1.8],
}

return 0.9 * average(cost["apples"]) + \
0.1 * average(cost["bananas"])
In the above example, we create a dictionary called cost that contains the costs of some fruit.
Then, we calculate the average cost of apples and the average cost of bananas. Since we like apples
much more than we like bananas, we weight the average cost of apples by 90% and the average cost
of bananas by 10%.
The \ character is a continuation character. The following line is considered a continuation of the
current line."""

"""Write a function called get_average that takes a student dictionary (like lloyd, alice, or tyler)
 as input and returns his/her weighted average.

Define a function called get_average that takes one argument called student.
Make a variable homework that stores the average() of student["homework"].
Repeat the above step for "quizzes" and "tests".
Multiply the 3 averages by their weights and return the sum of those three. Homework is 10%, quizzes are 30% and tests are 60%
"""

lloyd = {
    "name": "Lloyd",
    "homework": [90.0, 97.0, 75.0, 92.0],
    "quizzes": [88.0, 40.0, 94.0],
    "tests": [75.0, 90.0]
}
alice = {
    "name": "Alice",
    "homework": [100.0, 92.0, 98.0, 100.0],
    "quizzes": [82.0, 83.0, 91.0],
    "tests": [89.0, 97.0]
}
tyler = {
    "name": "Tyler",
    "homework": [0.0, 87.0, 75.0, 22.0],
    "quizzes": [0.0, 75.0, 78.0],
    "tests": [100.0, 100.0]
}

# Add your function below!
def average(numbers):
    total = sum(numbers)
    total = float(total) / float(len(numbers))
    return total

def get_average(student):
    homework = average(student["homework"])* 0.1
    quizzes = average(student["quizzes"])* 0.3
    tests = average(student["tests"])* 0.6

    avrg = homework + quizzes + tests
    return avrg
