names = ['Cuba I', 'San Felipe II Okeechobee', 'Bahamas', 'Cuba II', 'CubaBrownsville', 'Tampico', 'Labor Day', 'New England', 'Carol', 'Janet', 'Carla', 'Hattie', 'Beulah', 'Camille', 'Edith', 'Anita', 'David', 'Allen', 'Gilbert', 'Hugo', 'Andrew', 'Mitch', 'Isabel', 'Ivan', 'Emily', 'Katrina', 'Rita', 'Wilma', 'Dean', 'Felix', 'Matthew', 'Irma', 'Maria', 'Michael']
record_damages = ['Damages not recorded', 100000000.0, 'Damages not recorded', 40000000.0, 27900000.0, 5000000.0, 'Damages not recorded', 306000000.0, 2000000.0, 65800000.0, 326000000.0, 60300000.0, 208000000.0, 1420000000.0, 25400000.0, 'Damages not recorded', 1540000000.0, 1240000000.0, 7100000000.0, 10000000000.0, 26500000000.0, 6200000000.0, 5370000000.0, 23300000000.0, 1010000000.0, 125000000000.0, 12000000000.0, 29400000000.0, 1760000000.0, 720000000.0, 15100000000.0, 64800000000.0, 91600000000.0, 25100000000.0]
def greatest_damage(record_damages, names):
names_damages = dict(zip(record_damages, names))
greatest_damage = {}
for damage, name in names_damages.items():
if damage != "Damages not recorded":
greatest_damage.update({name: damage})
else:
continue
return greatest_damage
greatest_damage = greatest_damage(names, record_damages)
print(greatest_damage)
This is the list I get:
{‘Damages not recorded’: ‘Anita’, 100000000.0: ‘San Felipe II Okeechobee’, 40000000.0: ‘Cuba II’, 27900000.0: ‘CubaBrownsville’, 5000000.0: ‘Tampico’, 306000000.0: ‘New England’, 2000000.0: ‘Carol’, 65800000.0: ‘Janet’, 326000000.0: ‘Carla’, 60300000.0: ‘Hattie’, 208000000.0: ‘Beulah’, 1420000000.0: ‘Camille’, 25400000.0: ‘Edith’, 1540000000.0: ‘David’, 1240000000.0: ‘Allen’, 7100000000.0: ‘Gilbert’, 10000000000.0: ‘Hugo’, 26500000000.0: ‘Andrew’, 6200000000.0: ‘Mitch’, 5370000000.0: ‘Isabel’, 23300000000.0: ‘Ivan’, 1010000000.0: ‘Emily’, 125000000000.0: ‘Katrina’, 12000000000.0: ‘Rita’, 29400000000.0: ‘Wilma’, 1760000000.0: ‘Dean’, 720000000.0: ‘Felix’, 15100000000.0: ‘Matthew’, 64800000000.0: ‘Irma’, 91600000000.0: ‘Maria’, 25100000000.0: ‘Michael’}
I know it’s not the final solution for the exercise, but I do not why the functions works to eliminate all the “Damages not recorded” but the one for the Anita hurricane