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

https://www.codecademy.com/paths/computer-science/tracks/cspath-flow-data-iteration/modules/dspath-lists/projects/gradebook

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”)
grades.append(100)
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?

1 Like

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

12 Likes

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