For The Record


#1



https://www.codecademy.com/courses/python-beginner-en-qzsCL/0/4?curriculum_id=4f89dab3d788890003000096


The name Lloyd is printed on console but somehow I cannot proceed because of this error message "Oops, try again. Did you print out each student's name? It looks like "Lloyd" wasn't printed."

Did I miss out on anything?
Also, is %s the only way to display float numbers in the "homework", "quizzes" and "tests"? %d did not work for me


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]

for student in students:
    print "Name: %s" % student["name"]
    print "Homework: %s" % student["homework"]
    print "Quizzes: %s" % student["quizzes"]
    print "Tests: %s" % student["tests"]


#2

problem 1.

The name Lloyd is printed on console but somehow I cannot proceed because of this error message "Oops, try again. Did you print out each student's name? It looks like "Lloyd" wasn't printed."

Lets dissect the problem.
Lets see whats the problem asking.

If you look the instruction thoughtfully, It says print just the Name of student not to print Name: Name of student

More precisely --

print student["name"]

NOT

print "Name: %s" % student["name"]

I hope it clears your doubts and error.

Problem 2 (precisely it's a question):

is %s the only way to display float numbers in the "homework", "quizzes" and "tests"? %d did not work for me

Nope, There are many specifiers, %s is one of them.
Wanna read a bit more about them ?

Here : Python 2.7: %d, %s, and float()

Ps: All the answers are given with respect to the link you have provided. I hope it helps.


#3

Hello greentreeme,

Looks like I was trying to be too smart about it by adding things to the print statement.
Thank you so much for all the assistance!


#4

You're welcome! :slight_smile:


#5

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