Welcome to the Get Help category!
This is where you can ask questions about your code. Some important things to remember when posting in this category
- Learn how to ask a good question and get a good answer!
- Remember to include a link to the exercise you need help with!
- If someone answers your question, please mark their response as a solution
- Once you understand a new concept, come back and try to help someone else!
Hi. Can anyone explain this to me.
In [Python dictionaries (data science - medical insurance project)] exercise, I tried this.
names = [“Marina”, “Vinay”, “Connie”, “Isaac”, “Valentina”]
ages =[27, 24, 43, 35, 52]
zipped_ages = zip(names, ages)
print(list(zipped_ages))
output: [(‘Marina’, 27), (‘Vinay’, 24), (‘Connie’, 43), (‘Isaac’, 35), (‘Valentina’, 52)]
Then when I entered this:
names_to_ages = {key:value for key, value in zipped_ages}
print(names_to_ages)
output: {}
Can anyone explain why?