This question is in reference to the following exercise: https://www.codecademy.com/paths/data-analyst/tracks/dacp-python-fundamentals/modules/dscp-python-dictionaries-challenge-projects/projects/hurricane-analysis
I am having a really tough time getting started with this exercise. It appears that I need to take a list and build a function that populates it with string values that are being converted to float using a dictionary.
My thoughts went something like:
- Build a function that iterates through the characters of the strings and multiplies the values by the appropriate dictionary value if that character matches (“M” and “B”). Then converts it to a float and adds the new value to a new list.
- If it is not a a numerical value, then add it to the list to capture the “Damages not recorded” strings.
- Print the list after it has run through all the iterations.
I am running into a couple problems and I am really hard-stuck for the first time during the lessons, I have googled, reviewed the cheat sheets and looked at some python library documentation.
- How do I convert a string to a float while retaining the other strings (“Damages not recorded”)?
- How do I call a dictionary to modify a string (aka multiply the dictionary values to the list values) inside the function?
I am not looking for someone to write the code for me. I am more looking for people to help me get started so I can progress pass this first step and move on. Maybe my thinking is flawed or I am over complicating an easy problem but for now I have just stutter-stepped for 4 hours after attempting several of my own solutions and have gotten nowhere.