python - Codecademy Student Becomes the Teacher -
I have problems with a lesson in codecady, can someone help me? "Loyd", "Homework": [90.0, 97.0, 75.0, 92.0], "Quiz": [88.0, 40.0, 94.0] "Exam":
lloyd = {"name" [89.0, 83.0, 91.0], "Test": [89.0, 90.0]} Alice = {"Alice", "Homework": [100.0, 92.0, 98.0, 100.0], "Quiz" 97.0]} Tyler = {"Name": "Tyler", "Homework": [0.0, 87.0, 75.0, 22.0], "Quiz": [0.0, 75.0, 78.0], "Test": [100.0, 100.0] Def Average (number): Total = 0 total = sum (number) result = float (total) / lane (number) Return results DEF get_Average (student): homework = 0.1 * average (student ["homework"]] quiz = 0.3 * Average (student ["quiz"]) Returning homework + quizzes + exams student = [Lloyd, Alice, Tyler] students = [Lloyd, Alice, Tyler] def get_class_average (students): results = [] in students For each: results.append (get_average) return average (results) "Oh, try again. Your get_class_average function only takes one input (the student has a list) )? Your code throws "The list index should be an integer, no str" error. "
student is a global list. It is not clear if you Why are you trying to get inside your code (for code) (or why this is exactly why). You probably mean get_average (each) .
Comments
Post a Comment