Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created September 2, 2020 17:51
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/95a7db453c8cc1a4015f5c57e580d0a3 to your computer and use it in GitHub Desktop.
Save codecademydev/95a7db453c8cc1a4015f5c57e580d0a3 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
count = 0
for year in years:
multiple_hurricanes = []
if year in hurricane_years.keys():
if count == 0:
multiple_hurricanes.append(hurricane_years[year])
multiple_hurricanes.append(hurricane_facts[index])
hurricane_years[year] = multiple_hurricanes
index += 1
count += 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
count = 0
return hurricane_years
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment