6/9 My own way


#1

Tried my hand at doing it without reading the instructions. Clunkier than their for sure, but it works. anyone else do it their own way?

def get_average(student):
avg = 0
for x in student:
if x != "name":

        value = average(student[x])
        if x == "homework":
            avg = avg + 0.1*value
        elif x == "quizzes":
            avg = avg + 0.3*value
        elif x == "tests":
            avg = avg + 0.6*value
    print avg
return avg

#2

"Beautiful is better than ugly"
"Readability counts"
"Complex is better than complicated"
etc

def get_average(student):
homework = average(student["homework"])
quizzes = average(student["quizzes"])
tests = average(student["tests"])
return (homework * .1) + (quizzes * .3) + (tests * .6)

#3

Thanks that really helped me!


#4

Where are you getting the .1, .3, and the .6... I am trying to figure that part out.

Please let me know.. thanks..


#5

dude thats 10% 30% and 60%......10/100=.1
30/100=.3 and so on.


#6

Read carefully conditions of the exercise.