KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to construct a dictionary in python. Code looks like this: dicti = {} keys = [1, 2, 3, 4, 5, 6, 7, 8, 9] dicti = dicti.fromkeys(keys) values = [2, 3, 4, 5, 6, 7, 8, 9] How can I populate values of dictionary using a list? Is there some built in function? The result should be like this: dicti = {1:2,2:3,3:4,4:5,5:6,6:7,7:8,8:9}
Tags (comma-separated)
Save Edits
Cancel