Hey. Task completed.
names = ("Bob", "Elena", "Mark", "Tom")
ages = (15, 14, 16, 17)
#create dictionary
dictionary = {}
for i in range(len(names)):
dictionary[names[i]] = ages[i]
print(dictionary.items()) #use items method
#use zip and enumerate functions
for i, (val1, val2) in enumerate(zip(names, ages)):
print(str(i+1)+ ".", val1, "-", str(val2))
Comments
Leave a comment