Student Becomes the Teacher: It's Okay to be Average


Hey there! I know that I am doing it wrong (as it doesnt work) but at least I have put something together. Could I humbly ask for a help (as I dont know what to do)?


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!

# Define a function called average that has one argument, numbers.
def average(numbers):
# Inside the function, call built-in sum() with the numbers list as a parameter.
# Store the result in a variable called total.    
    for n in numbers:
#Like above, use float() to convert total and store the result in total.
# Divide total by the length of the numbers list. Use the built-in len() function to # # calculate that.        


sum() will give you the sum of the numbers in the list, no need to build a loop.

from your comment:

# Divide total by the length of the numbers list

but then you do: len(total), but total doesn't contain a list?


Just a note for others not knowing what to do:

def average(numbers):
TABtotal = sum(numbers)
TABtotal = float(total) / len(numbers)
TABreturn total

which I found out on google.


You are rushing through the exercises, i recommend to take more time to read, and puzzle with the exercises to deepen your understanding


I know. The problem is that I need to master this for my work. So I am at least creating a sort of a dictionary of useful keywords and paragraphs for a latter use...

The tutorials themselves are very frustrating for me, making me rush them thru to have them behind as soon as possible. Perhaps this web (very nicely put together, indeed) is not intended for people with zero experience.


Its designed for beginners, its not designed to be rushed through


Im getting a bit offtopic but - during my Solid mechanics studies it was like this: This is the theory (make sure to understand and remember), this is the application. Try it yourself on an engineering problem. And then an exam where you described the theory in own words and reapplied the solution of the problem. An example>task system.

The job that I do for living is similar. You look up a keyword in a documentation, look up the parameters it uses and simply repeat that. If you do it wrong, the solver tells you where the problem is (parameter missing, keyword missplaced, whatever).

Here I found some points missing, the tasks asking me for concepts that were not shown or clearly (enough for me?) described. I dont really need to memorize how a certain paragraph should look and how many times I have to press tab to make it work. I need to create simple scripts for performing my job more effectively (like opening a file, finding all lines beginning with a certain word and exporting them into another txt)

This only frustrates me even more with each and every chapter. : /

I know that you cannot help me with that, just...


i haven't seen this, but i can't say anything about this, but in programming this doesn't work. You don't have to remember the syntax (you have documentation for this), but you do need to remember concepts. Why you indent, why indent is important for example.

You need to learn to design a program and debugging, codecademy gives you friendly error message, the python interpreter won't.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.