Answers for "iterate through keys in dictionary"

97

python iterate dictionary key value

a_dict = {'color': 'blue', 'fruit': 'apple', 'pet': 'dog'}
for key, value in a_dict.items():
  print(key, '->', value)
Posted by: Guest on December-13-2019
3

python generate dictionary in loop

n = int(input())
ans = {}
for i in range (1,n+1):
  ans[i] = i * i
print(ans)
Posted by: Guest on February-04-2020
0

iterate through keys in dictionary

dictionary_name={"Name": "John", "Age": 29, "salary":25000,"Company":"GOOGLE"}    
for key in dictionary_name.keys():
    print(key)
Posted by: Guest on April-12-2021
0

iterate through keys in dictionary

for key in dictionary_name:
Posted by: Guest on August-08-2020

Code answers related to "iterate through keys in dictionary"

Python Answers by Framework

Browse Popular Code Answers by Language