TypeError: object of type 'zip' has no len() i

Hi! I’m getting this error: TypeError: object of type ‘zip’ has no len()

This is for question no. 4 from n Working with Python Lists: Medical Insurance Project. Can someone tell me why I keep getting this error?

My code is here: https://gist.github.com/ec72f1aa68772c18bada105d9a4b7e22

medical_records = zip(names, insurance_costs)
print(list(medical_records))

#The length of medical records
num_medical_records = len(medical_records)

ZIP objects do not have a len attribute. That last line triggers this error.


>>> len(zip([1, 2, 3], [4, 5, 6]))
Traceback (most recent call last):
  File "<pyshell#223>", line 1, in <module>
    len(zip([1, 2, 3], [4, 5, 6]))
TypeError: object of type 'zip' has no len()
>>> 
2 Likes