Python Dictionaries Challenge, Hurricanes Dictionary part

Python Dictionaries Challenge Project | Codecademy

I’ve written the function but when I print it, I only get the last dictionary. It feels like I’m missing one small step…is there anyone who can help?

def hurricane_dictionary(names, months, max_sustained_winds, areas_affected, damages_updated, deaths):
  for i in range(len(names)):
    hurricanes_dictionary = {"Name": names[i],
 "Month": months[i],
 "Year": years[i],
 "Max Sustained Wind": max_sustained_winds[i],
 "Areas Affected": areas_affected[i],
 "Damage": damages_updated[i],
 "Deaths": deaths[i]}
  return hurricanes_dictionary

print(hurricane_dictionary(names, months, max_sustained_winds, areas_affected, damages_updated, deaths))

This is the response I get:

{'Name': 'Michael', 'Month': 'October', 'Year': 2018, 'Max Sustained Wind': 160, 'Areas Affected': ['Central America', 'United States Gulf Coast (especially Florida Panhandle)'], 'Damage': 25100000000.0, 'Deaths': 74}

Using a dictionary literal, the {key:value, ...} style syntax will always create a new dictionary. What happens with each iteration of the loop?

If I’m not mistaken the original instructions request that hurricane_dictionary should be a dictionary where each key is a hurricane name and its associated value is itself a dictionary with the relevant hurricane details (month, max speeed etc.) as key-value pairs. You may need to alter your answer to make sure you get the nested dictionary structure requested.

In fact your hurricans_dictionary is the value which you need for your dictionary.
First, define an empty dictionary.
Second, define the key.
Third, define the value which will store another dictionary which must be defined and after that updated.
Four, return dictionary.update({key:value})
See my below code.

def remake_dictionary(names, months, years, max_sustained_winds, areas_affected, deaths):
  hurricane_dictionary = {}
  for i in range(0, len(names)):
    key = names[i]
    value = {}
    value.update({"Name": names[i], "Month": months[i], "Year": years[i], "Max Sustained Wind": max_sustained_winds[i], "Areas Affected": areas_affected[i], "Deaths": deaths[i]})
    hurricane_dictionary.update({key:value})
  return hurricane_dictionary