I'm doing a CodeAcademy activity where I zipped two lists together. I get different print results depending on the order they are placed.
names = ["Mohamed", "Sara", "Xia", "Paul", "Valentina", "Jide", "Aaron", "Emily", "Nikita", "Paul"]
insurance_costs = [13262.0, 4816.0, 6839.0, 5054.0, 14724.0, 5360.0, 7640.0, 6072.0, 2750.0, 12064.0]
medical_records = zip(insurance_costs, names)
print (list(medical_records))
num_medical_records = len(list(medical_records))
print(num_medical_records)
When I print I get the expected list, but the num_medical_records is 0? If I switch the order of my print statements, the result is an empty list, but printing num_medical_records gives me the correct number "11".
medical_records = zip(insurance_costs, names)
num_medical_records = len(list(medical_records))
print (list(medical_records))
print(num_medical_records)
Why is medical_records mutating? Greatly appreciate your insight!