I have a nested dictionary:
my_dict = {
1: {'player_id': 1,
'player_name': 'Bryan_Demapan',
'time_played': 0.0,
'player_pokemon': {},
'gyms_visited': []},
2: {'player_id': 2,
'player_name': 'Tom Syneal',
'gyms_visited': [],
'player_pokemon': {},
'time_played': 0.0}}
Suppose I have a list
new_list = ['A', 'B', 'C']
How would I make a for loop statement that inserts my new list into all the empty lists with the key 'gyms_visited'?
the new dictionary should look like this
my_dict = {
1: {'player_id': 1,
'player_name': 'Bryan_Demapan',
'time_played': 0.0,
'player_pokemon': {},
'gyms_visited': ['A', 'B', 'C']},
2: {'player_id': 2,
'player_name': 'Tom Syneal',
'gyms_visited': ['A', 'B', 'C'],
'player_pokemon': {},
'time_played': 0.0}}