TypeError: unsupported operand type(s) for +: 'zip' and 'list'

I get this error, I don’t understand why :pensive: :

Traceback (most recent call last):
** File “script.py”, line 19, in **
** full_gradebook = gradebook + last_semester_gradebook**
TypeError: unsupported operand type(s) for +: ‘zip’ and 'list’

last_semester_gradebook = [("politics", 80), ("latin", 96), ("dance", 97), ("architecture", 65)]

subjects = ["physics", "calculus", "poetry", "history"]

grades = [98, 97, 85, 88]

gradebook = zip(subjects, grades)

subjects.append("computer science")
grades.append(100)

subjects.append("Visual arts")
grades.append(93)

print(list(subjects))
print(list(grades))
print(list(gradebook))

full_gradebook = gradebook + last_semester_gradebook

print(list(full_gradebook))

Check what happens when you print gradebook out.

The error is specific! You are trying to add a zip and a list. If you can make it a list and a list you’ll be ok in terms of errors (you can’t use the + operator on a zip and a zip, for reference).

2 Likes