Python: Creating a Dictionary with Two Lists

Post Reply
User avatar
Jason
Site Admin
Posts: 919
Joined: Sun Dec 21, 2025 8:56 pm

Code: Select all

print("Top Three Finalists in the Race:")

keys = ['1', '2', '3']

values = ['tortoise', 'hare', 'penguin']

dictionary_of_race_finalists = dic(zip(keys, values))

for d in dictionary_of_race_finalists:

print(d)
 

POSTREACT(ions) SUMMARY

Post Reply