How to print a dictionary keys and values in Python

1 Answer

0 votes
dict = {'python': 5, 'php': 3, 'java': 9, 'c++': 1}

for key, value in dict.items():
    print(key, value)


 
 
'''
run:
 
python 5
php 3
java 9
c++ 1
 
'''

 



answered Oct 21, 2020 by avibootz
...