Hurricane Analysis Challenge Project (Python)

Howdie Mates, still need to cleanup and how to iterate by sending more variables and reuse functions, but so far mission accomplished.

I loved doing this! You can find some tunes that I listened to while coding in the README file.

My project:

Tried my first time creating repo on Github! :green_heart:
Happy coding!

This is my code for this project. I also included comments on my thought process and how I arrived at my solution.

Hi everyone, I share my solution link on GitHub:

Happy coding.

https://www.codecademy.com/workspaces/62b48024d012db71e9f54fcd

Took me a while, but here is my code: :smiley:

Hi everyone,

project was pretty interesting to do although it took me a bit of time. Here is my code!
I will be glad to hear your feedback.
https://github.com/MayaViko/hurricane_analysis_challenge_project.git

This is my project solustions. It was fun! All feedback is welcome, thanks!

Thank you for designing this practice!

Here’s my code

here is my code, this was a fun and challenging project

Here is my code:

Hi Annajiali,

I am struggling a lot with the logic behind the code in your solution for the first block.

if damage.find(‘M’) != -1:

I don’t understand how this works because, in theory, we are looking for strings that have the last character of ‘M’. Yet, it still works, but I can’t understand why.

.find('M') looks for any M in the string, and returns the index of the first M it finds.
If there is no M,   then .find('M') returns -1.

So the if statement is meant to deal with a situation where there was no 'M'.

2 Likes

@amdesanti , I think you’re interpreting the -1 as an index position. .find() only returns positive indices. I was confused by this myself. Here’s a simple example of the situation:

bob = “knob”
bob.find(“M”)
-1
bob.find(“b”)
3

Thanks for responding to this!

Yes, I looked up the method specs in the python documentation. I was getting it confused as the index position.

str. find (sub [, start [, end ]])

Return the lowest index in the string where substring sub is found within the slice s[start:end]. Optional arguments start and end are interpreted as in slice notation. Return -1 if sub is not found.

This is my code, it was fun to make this exercise. It was also very reguarding to look that the answer was not as far as my solution… although i’m curious about how task 5 could be done wit defaultdict object…