How to create a dictionary from list with specific same value for all items in Python

1 Answer

0 votes
language = ['python', 'php', "java", 'c++']

dic = dict.fromkeys(language, 7)

print(dic)


'''
run:

{'python': 7, 'php': 7, 'c++': 7, 'java': 7}
  
'''

 



answered Aug 29, 2018 by avibootz
...