This is what I have:
names = ['Bob', 'Mike', 'Nia', 'Tim', 'Holly', 'Liam', 'Dave']
temperatures = ['-0.3', '-0.6', '-0.8', '-0.2', '-1.3', '-2.1', '-0.4']
main_dictionary = {'Bob' : '-0.3', 'Mike': '-0.6', 'Nia' : '-0.8', 'Tim':'-0.2', 'Holly':'-1.3', 'Liam':'-2.1', 'Dave':'-0.4'}
I'm trying to produce a dictionary by comparing it to the list of selected_names against the main_dictionary to produce the updated_dictionary
selected_names = ['Nia', 'Holly', 'Liam', 'Dave']
updated_dictionary = {'Nia' : '-0.8', 'Holly':'-1.3', 'Liam':'-2.1', 'Dave':'-0.4'}
So far in my project Ive compared many lists using .intersection but can seem to work out how to apply it to a dictionary.