Categories
How to make a dictionary with keys from list and values 0?
a = ['i', 'was', 'three', 'near'] Dict = {} result Dict = { 'i': 0, 'was': 0, 'three': 0, 'near': 0 }
Answer the question
In order to leave comments, you need to log in
Dict = {i: 0 for i in a}
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question