Practice · Python

Practice String Indexing

Access individual characters by zero-based index, including negative indices, and reason about valid index ranges.

String Indexingwarming python…

First and Last Player Initials

Write a function first_and_last(s) that receives a sport‑related word s and returns a tuple containing its first and last character. For example, first_and_last("soccer") should return ('s', 'r'). If the word has only one character, both elements of the tuple will be that character.

Press Run to see output, or Check to grade against the tests.

Want a whole course built around string indexing?

Start my path — free

Adaptive practice, streaks, projects with real code review. Free tier gates AI help, never content.