Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created September 1, 2020 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/d646a7fa3c448a9f70e75de5f1ffce18 to your computer and use it in GitHub Desktop.
Save codecademydev/d646a7fa3c448a9f70e75de5f1ffce18 to your computer and use it in GitHub Desktop.
Codecademy export
def hurricane_years(hurricanes, years=years):
hurricane_facts = []
for info in hurricanes.values():
hurricane_facts.append(info)
hurricane_years = {}
index = 0
for year in years:
multiple_hurricanes = []
if year in hurricane_years.keys():
if len(hurricane_years[year]) == 7:
multiple_hurricanes.append(hurricane_years[year])
multiple_hurricanes.append(hurricane_facts[index])
hurricane_years[year] = multiple_hurricanes
index += 1
else:
for h in hurricane_years[year]:
multiple_hurricanes.append(h)
multiple_hurricanes.append(hurricane_facts[index])
hurricane_years[year] = multiple_hurricanes
index += 1
else:
hurricane_years[year] = hurricane_facts[index]
index += 1
return hurricane_years
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment