4.1.2 Accessing Characters by Index

Unit: Unit 4: Strings, Lists, and Tuples • Interactive Practice

Quick Answer & Summary:

Interactive Python programming tutorial and practice in your browser.

Interactive Challenge (Run Live in Browser):

# Access individual characters from the string
language = "Python"

# 1. Access first character using positive index 0
first_char = language[0]

# 2. Access third character (index 2)
third_char = language[2]

# 3. Access last character using negative index -1
last_char = language[-1]

print("First:", first_char)
print("Third:", third_char)
print("Last:", last_char)
Open in Live Interactive Python Sandbox →