I am working on a python assignment struggling with list comprehension. Basically this is the nested for loop I need to convert into a list comprehension function:
for driver in standings:
if driver['driver'] in drivers_with_points.keys():
driver['points'] = drivers_with_points[driver['driver']]
This is the question prompt:
"""Updates the < standings > list by adding the points from the given race < results >.
Using a list comprehension, updates each dictionary in < standings > at
the key 'points' with the points value retrieved from the < drivers_with_points >
dictionary.
Parameters:
standings (list): A list of dictionaries, each containing information about a
driver's standing.
drivers_with_points (dict): A dictionary containing the name and points scored
by each driver who scored points in a race.
Returns:
None
"""