Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Exercise: Print all the locations in a string

  • Create a file called location_in_string.py
  • Given a string like "The black cat climbed the green tree.", print out the location of every "c" character.

Expected:

7
10
14