Hello,
While running this line using “Return” to display looped information, I find it convenient that it display itself by line for each iteration :
def rating_hurricanes(dictionnary):
mortality_scale = {0: 0,
1: 100,
2: 500,
3: 1000,
4: 10000}
hurricanes_deaths = {0:[], 1: [], 2: [], 3: [], 4: []}
for keys in dictionnary:
name = dictionnary[keys]
death_count = dictionnary[keys]["Deaths"]
if death_count < 100:hurricanes_deaths[0].append(name)
elif 100 < death_count < 500:hurricanes_deaths[1].append(name)
elif 500 < death_count < 1000:hurricanes_deaths[2].append(name)
elif 1000 < death_count < 10000:hurricanes_deaths[3].append(name)
elif death_count > 10000:hurricanes_deaths[4].append(name)
return hurricanes_deaths
However, when I print it, unfortunately it displays itself in a continuous line.
How can I make it, so it displays itself like a return display and not a print display ?
Like this : Return
{0: [{‘Name’: ‘Cuba I’,
‘Month’: ‘October’,
‘Year’: 1924,
‘Max Sustained Wind’: 165,
‘Areas Affected’: [‘Central America’,
‘Mexico’,
‘Cuba’,
‘Florida’,
‘The Bahamas’],
‘Damage’: ‘Damages not recorded’,
‘Deaths’: 90},
It would be even better if 'Areas Affected" would display in one line :
‘Areas Affected’: [‘Central America’, 'Mexico, ‘Cuba’, ‘Florida’, ‘The Bahamas’]
But it always print like this : Print
[{‘Name’: ‘Cuba I’, ‘Month’: ‘October’, ‘Year’: 1924, ‘Max Sustained Wind’: 165, ‘Areas Affected’: [‘Central America’, ‘Mexico’, ‘Cuba’, ‘Florida’, ‘The Bahamas’], ‘Damage’: ‘Damages not recorded’, ‘Deaths’: 90},
I hope it’s clear enough,