-
-
Save codecademydev/d646a7fa3c448a9f70e75de5f1ffce18 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 | |
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