Creating and Modifying a List in Python LESSON-Zip

Hello everyone,
I am on this lesson:
Here is my original code:

I initially wrote the code and it gave me an error asking me if I wrote names_and_dogs_names with list in front but it did give me the correct output (I checked in Solutions after):
[(‘Jenny’, ‘Elphonse’), (‘Alexus’, ‘Dr. Doggy DDS’), (‘Sam’, ‘Carter’), (‘Grace’, ‘Ralph’)]

my code:

names = [‘Jenny’, ‘Alexus’, ‘Sam’, ‘Grace’]
dogs_names = [‘Elphonse’, ‘Dr. Doggy DDS’, ‘Carter’, ‘Ralph’]
names_and_dogs_names = zip(names, dogs_names)

Then I clicked on view solution and the code changed to include:
list_of_names_and_dogs_names = list(names_and_dogs_names)
and the print changed.

but the output was the same:
[(‘Jenny’, ‘Elphonse’), (‘Alexus’, ‘Dr. Doggy DDS’), (‘Sam’, ‘Carter’), (‘Grace’, ‘Ralph’)]

What is the difference?

Thank you for helping!

If it’s supposed to be a list, is it?


Thank you for answering again ionatan.
I did not get print(type(names_and_dogs_names)) in the solution.
I wrote: print(list(names_and_dogs_names)) and the answer was the same as the solution.

When I run print(type(names_and_dogs_names)) it shows <class ‘zip’>, so its a list combination.
In that case I ran a list in list so I don’t understand why it showed me a mistake.

you can print its type to find out what type it has.
your error message is saying it should be a list. when you print its type, you would therefore have to see “list” for it to be the correct type.

there’s a second problem as well, which is that you consume the zip object, leaving it empty. but fixing the type will fix that as well