Python Hurricanes Analysis Project (step 2)

Hey! Just started my Hurricane Analysis project ( and I’m already stuck on updating the damages to floats and running the conversions - I feel like the code I have makes sense, and I’m not sure what’s wrong with it that it’s not working.

# Update Recorded Damages
conversion = {"M": 1000000,
              "B": 1000000000}
updated_damages = []

#convert damages to floats
def damages_float(damages):
  for damage in damages:
    if damage == "Damage not recorded":
    if damage[-1] == "M":
    if damage[-1] ==  "B":

# test function by updating damages
updated_damages = damages_float(damages)

I know I’m missing something but I’ve tried a variety of other solutions and nothing seems to be getting me there (including using .find with != and, at one point, just ignoring the dictionary altogether and trying with integers).

Any guidance would be much appreciated. Thanks!

You’ve not explained what’s wrong, errors or unexpected behaviour etc.
I think the following might be a useful hint-

test = "a" * 3

The unexpected result is that there’s…no result. Nothing prints. I don’t get an error but I also don’t get any text, or an empty list, or…anything.

I’m not sure I follow the hint?

Well I did say it might be useful, guessing what’s wrong is tricky business though I think it may prove useful. As for your issue, it might be worth having a brief recap of functions. It is often necessary to be somewhat literal when programming. If you want to get the computer to perform a task then you need to explicitly state you want that task done. So your function does not print or return anything, it’s worth double checking as to whether or not you asked it to.