-
-
Save codecademydev/95a7db453c8cc1a4015f5c57e580d0a3 to your computer and use it in GitHub Desktop.
Codecademy export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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