Wats wrong


#1


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):
sum(numbers)
total = float(total)
total = float(total) / len(numbers)
return total


Replace this line with your code.


#2

you don't store the result of getting the sum anywhere.


#3

plz elaborate??????????


#4

you take the sum of numbers, but don't store this total anywhere?


#5

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):
b= sum(numbers)
total = float(total)
total = float(total) / len(numbers)
return total

stillshowing error???


#6

step two is to convert the sum (which you stored in b), to a float. But you convert total (which is undefined) to a float.


#7

def average(numbers):

float(b)= sum(numbers)
total = float(total)
total = float(total) / len(numbers)
return total
like this?????????


#8

you already have the conversion? But you stored the sum in b and not in total


#9

still not getting ya????????


#10

Ok so what exactly do you not understand about what @stetim94 is trying to explain to you? Your code is very close but you have a few mistakes still left to overcome.


#11

actually i dont even know wat result gonna b ?? dont understand the mistakes he is tellling


#12

from the instructions:

Inside that function, call the built-in sum() function with the numbers list as a parameter. Store the result in a variable called total

you stored the result in a variable called b, which is fine, but you have to keep this in mind for the next step

then next step:

like the example above, use float() to convert total and store the result in total

to convert total, but you stored total in b, not in a variable called total

so either store the sum in a variable called total or use float() to convert b.


#13

You're storing sum(number) in b but are not calling b in the latter part of the code, So you just have toedit 1thing that is don't store your sum(number) in b instead store it in the total.

Your code should be like this

def average(numbers):

sum(numbers)
total = sum(numbers)
total = float(total)
total = total / len(numbers)
return total


#14

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