List of String does not accept inverted comma


Error Message i get was
Oops, try again. It looks like Lloyd is not in the students list.

i managed to solve the problem by changing it to students = [lloyd, alice, tyler]

but why didn't python accept the inverted comma for the string in this case?

Replace this line with your code. 

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']


why you're putting variables in quotes?
like 'lloyd', 'alice' and 'tyler' ?

Your function (get_class_average() function) takes list as input . (that takes students as i/p list)
Then it process through each variables (lloyd, alice or tyler dictionaries)..
get_class_average() function can't actually access string value (or any value) of their names without accessing these variables


i thought that the lloyd, alice, tyler are strings?
sorry, why did you mention (get_average() function)?


no, they shouldn't be strings. You can store dictionaries (or rather references to dictionaries) in a list, which is what you do here


ah yes.... got it. thanks :slight_smile:


and reversed comma's have a name, they are named apostrophes.


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