How's my comprehension of the concepts?


I have successfully completed the course. Can you let me know how my code looks?

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]

students = [lloyd, alice, tyler]

def average(numbers):
    total = float(sum(numbers))
    total = total / len(numbers)
    return total
def get_average(student):
    homework = average(student["homework"])
    quizzes = average(student["quizzes"])
    tests =average(student["tests"])
    return 0.1 * homework + 0.3 * quizzes + 0.6 * tests
def get_letter_grade(score):
    if score >= 90:
        return "A"
    elif score >= 80:
        return "B"
    elif score >= 70:
        return "C"
    elif score >= 60:
        return "D"
        return "F"
print get_letter_grade(get_average(lloyd))

def get_class_average(students):
    results = []
    for student in students:
    return average(results)
print get_class_average(students)
print get_letter_grade(get_class_average(students))


It looks like it should, according to the instructions. We are not here to re-invent the wheel, but learn how the wheel is built and how it functions. As you progress you will be able to revisit this beginner module and look at ways to refactor it or make it into a more universal working program. This is not that time, though, so pat yourself on the back for following along and doing a good job of it.


Thank you friend <3 I just figured if I keep on doing the exercises, eventually I'll figure out why I'm doing them they way I'm doing them. It seems like a reach to be able to write this stuff from scratch right now.


How did you blur it out? I'd like to be able to do that.


That is why it is so important to follow along. So many learners want to get right in there and start messing with the code, which only creates a disruption for themselves and the others when questions surface. Those questions would not surface if they stuck with the lesson plan and completed the track.

We are free to return to our old lessons (as long as they exist in our profile) and redo them, experiment with them, toy with ideas, etc. So long as we make progress and do not deviate (or get hung up on something that looks strange or that we disagree with) we will reach the end of the track and pick up an awful lot along the way.

The review process should include going back over all the lessons that give us trouble, looking up terms and concepts in the documentation, forum discussions and other online tutelage resources. Practice, read, practice some more, read some more, experiment and practice until everything is sound in your own mind. It is not something that just sticks, right off. Repetition is the best, especially if we do not cloud our good judgement with our own precocious ideas. (Not that you are doing this; it's meant as general advice.)

Happy coding!


Wonderful advice. I really appreciate your encouragement. It is very similar to learning a language. The steps are the same.


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