#6 Python Programming Exercise
Construct a dictionary (with key and value pairs) out of 2 lists.
names = ['Adam', 'Daniel', 'Ana']
ages = [34, 12, 54]
These are the values in the names and ages lists accordingly. The aim is to end up with a single dictionary data structure with the names (as keys) and the ages (as the values accordingly).
Good luck!
=============================================
#6 Python Programming Solution
names = ['Adam', 'Daniel', 'Ana']
ages = [34, 12, 54]
my_dict = {}
for key, value in zip(names, ages):
my_dict[key] = value
print(my_dict)
This is how we can end up with the dictionary data structure. Of course there may be several solutions!