avatar Intro Bite 05. Slice and dice

Take the block of text provided and strip off the whitespace at both ends. Split the text by newline (\n).

Loop through the lines, for each line:

  • strip off any leading spaces,
  • check if the first character is lowercase,
  • if so, split the line into words and get the last word,
  • strip off BOTH the trailing dot (.) and exclamation mark (!) from this last word,
  • and finally add this last stripped word to the results list.

Return the results list.

Login and get coding
go back Intro level
Bitecoin 1X

3583 out of 3908 users completed this Bite.
Will you be the 3584th person to crack this Bite?
Resolution time: ~44 min. (avg. submissions of 5-240 min.)
Our community rates this Bite 5.55 on a 1-10 difficulty scale.
» Up for a challenge? 💪

Focus on this Bite hiding sidebars, turn on Focus Mode.

Ask for Help