oldoc63 / learningDS

Learning DS with Codecademy and Books
0 stars 0 forks source link

.find() #345

Open oldoc63 opened 1 year ago

oldoc63 commented 1 year ago

Another interesting string method is .find(). .find() takes a string as an argument and searching the string it was run on for that string. It then returns the first index value where that string is located.

oldoc63 commented 1 year ago

We searched the string 'smooth' for the string 't' and found that it was at the fourth index spot, so .find() returned 4.

You can also search for larger strings, and .find() will return the index value of the first character on that string. Notice that 2 is the index of the first o.

oldoc63 commented 1 year ago

In the code editor is the first line of Gabriela Mistral's poem God Wills It. At what index place does the word "disown" appear? Save that index place to the variable disown_placement.