Challenge: Calculate String Length

Follow the instructions to solve the challenge.

We'll cover the following

Solve the exercise

We are given a text file. The words in the text file are phonetically similar, with a heavy emphasis on the sh letters. Our task is to find the lengths of each word that include the sh sounds. Please follow the instructions to complete the challenge:

  1. Read the text file in the given directory below using the read_file() command.
"hello.txt"
  1. Turn the text into lowercase.

  2. Replace all \n characters with nothing.

  3. Create a list by splitting the text by the blanks.

  4. Choose the first element of the list.

  5. Create a detect object for the words that involve sh.

  6. Mask the detect object with the list object and assign a new variable to the outcome.

  7. Calculate the length of each word in the masked object.

  8. Name the outcome result.

Note: Naming the final output result is crucial to completing this challenge successfully.

Get hands-on with 1200+ tech skills courses.