AttributeError: 'zip' object has no attribute 'append'

My question is from the python gradebook project. " Your grade for visual arts just came in! You got a 93! After the creation of gradebook (but before you print it out), use append to add ("visual arts", 93) to gradebook " is task #6. Below is the code I have so far:

last_semester_gradebook = [(“politics”, 80), (“latin”, 96), (“dance”, 97), (“architecture”, 65)]
subjects = [“physics”, “calculus”, “poetry”, “history”]
grades = [98, 97, 85, 88]
subjects.append(“computer science”)
gradebook = zip(subjects, grades)
gradebook.append((“visual arts”, 93))

However, when I run it i get the error “AttributeError: ‘zip’ object has no attribute ‘append’”. I looked it up and apparently on python 3 the zip() turns it into a zip object and not a list, any ideas on how I can get this to work?


Nevermind I figured it out lol

gradebook = list(zip(subjects, grades)

Was able to fix it by turning it into a list, that way the append.() will work


@beta9196990428 Thanks for that info. I searched the web but couldn’t find append relating to zip.

Thank you so much for posting this. Was driving me nuts!

I didn’t understand why do we need to write this was…Could anybody please explain…Thanks

.append() is a list method, zip() does not return a list.


Thank you, I was not able to figure it out :blush: sometimes I feel really useless.

Thank you. I wouldn’t be able to figure it out myself.

super helpful! thanks for posting

yeah same thing faced me thanks for the help

Hi! Now that I’ve figured that out i keep getting a syntax error for that line even though I’ve literally copied it down exactly as the hint gives me! I don’t understand what the heck is wrong

gradebook = list(zip(subjects, grades)
gradebook.append((“visual arts”, 93))

File “”, line 15
gradebook.append((“visual arts”, 93))
SyntaxError: invalid syntax
WHYYYYY :frowning:

When dealing with syntax error, and especially the kind at the start of a line, also check the line above to ensure you closed everything off properly.


But that doesn’t change the fact that we’re told to use APPEND to add the subject “Visual Arts” and the score (93), but then Python can only append one argument at a time, so how should I deal with that?

a container still a single element, so could use tuple for example. The container/tuple can then contain multiple values

True, I wasn’t thinking clearly. What a difference an extra parenthesis can make o_O

don’t read literal symbols like parenthesis. Use general terms like container or tuple. This will better help you grasp concepts :slight_smile:

Will do. And speaking of ‘viewing things differently’, how do I let the Codecademy team know their instruction is now old and lead to confusion and don’t help to finish the exercise? Python 3 has been under recent changes and CC’s hints need to reflect those changes, not be stuck in the past. The exercise ‘Python Gradebook’ could use some updated instruction and just like the mobile app, there should be a flag icon to let them know something’s wrong with a given activity and needs to be reviewed.

You could make a report:

that is all i know.

Get Unstuck video is a great help!!

If you look at the hint on task 5 it already shows using list on gradebook. I was stuck on this as well and I assume it’s deliberate an that they expect you to work it out. Very annoying though!