String Index in Python

Level 118 keystrokes

This prints the first character of 'Python'. String indexing starts at 0, so [0] gives the first character.

Python code

# [0] picks the character at index 0 of "Python"
# Indexing starts at 0, not 1, so the first character "P" is printed
1print("Python"[0])

Output

P
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this Python code and how often they appear.

  • "× 2
  • (× 1
  • )× 1
  • [× 1
  • ]× 1

More Python examples at level 1

← Python typing practice