Codecademy's “Challenge Course”. You are the teacher of your own class. Make a gradebook for all of your students and manage your class information.
The purpose of the project is just personal learning. I may revisit this code to find different solutions or to apply it under other context.
-
There are three dictionaries: lloyd, alice, and tyler for each student. Each dictionary has keys "name", "homework", "quizzes", and "tests".
-
A list called students that contains the dictionaries lloyd, alice, and tyler.
-
Function print_student_record prints the information in each student record (tests, quizzes . . . etc. in order). There is also a print_student_record_unordered that just prints the contents of the student dictionary.
-
Calculate the average: function average takes a list of numbers and returns the average. It calls the built-in sum() function with the numbers list as a parameter and stores the result as float() in a variable called total. Then divides total by the length of the numbers list to calculate the average.
-
Calculate each student average: function get_average takes a student dictionary (like lloyd, alice, or tyler) as input and returns his/her weighted average by running the values in each student file (homework, quizzes and tests) through function average and then returning the sum of the value of each of these elements after adjusting their weight in the final grade.
-
function get_letter_grade takes one argument score that is a number and returns a letter score(>90="A", etc). This is done by using a chain of if: / elif: / else: statements.
-
Get the results of the whole class: function get_class_average takes one argument class_list that is a list containing the three students. Creates an empty list called results where the averages will be appended. For each student item in the class_list, calculates get_average(student) and then call results.append(). Returns the result of calling average() with results.
- Python 2
NA - It's only coding examples, there's no setup.
Project is: finished
Based on Codecademy's Learn Python 2 course, Student Becomes the Teacher