Why does it say none?

Here is the code:
i want to add computer scince subject and marks using the append() method. but when i run it, it says none. what’s wrong?

gradebook = [('physics',98),('calculus',97),('poetry',85),("history",88)]
print(gradebook)
gradebook = gradebook.append(("Compter Science",100))
print(gradebook)

[(‘physics’, 98), (‘calculus’, 97), (‘poetry’, 85), (‘history’, 88)]
None

.append() doesn’t return anything. the .append() method adds the element to the list (in memory)

so all you need to do:

gradebook = [('physics',98),('calculus',97),('poetry',85),("history",88)]
print(gradebook)
gradebook.append(("Compter Science",100))
print(gradebook)
2 Likes

Thank you so much! :slight_smile: