Whats wrong in this?


#1

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]
print "%s %s %s"%(students[0]["name"],students[1]["name"],students[2]["name"])
print "%s %s %s"%(students[0]["homework"],students[1]["homework"],students[2]["homework"])
print "%s %s %s"%(students[0]["quizzes"],students[1]["quizzes"],students[2]["quizzes"])
print "%s %s %s"%(students[0]["tests"],students[1]["tests"],students[2]["tests"])

#2

you need first the student name, then on the next line that students homework, student quizzes and students score, then the next student

I would seriously use a for loop.

and use markup when posting code on a forum:


#3

Please format your code correctly. Information on how to do that can be found here.

You need the student name, then the student's homework, quizzes, and score. Then move onto the next student. Try a for loop, rather than repeated print statements.


#4

Thanks a lot Sir for your help.


#5

Thanks a lot Sir for your help.


#6

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