Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn String Indexing in Python | Variables and Types in Python
Introduction to Python
course content

Course Content

Introduction to Python

Introduction to Python

1. First Acquaintance with Python
2. Variables and Types in Python
3. Conditional Statements in Python
4. Other Data Types in Python
5. Loops in Python
6. Functions in Python

book
String Indexing in Python

To access a specific character in a string, use square brackets with an index number inside. Remember, the index number is not the actual position of the character because indexing in Python starts at 0. Consider the example below for clarity.

12345
# Initial string site = "codefinity" # Get the letters 'o' and 'y' print(site[1], site[9])
copy
Imagine you're given the string `test`. Identify the character that corresponds to the index `6`.

Imagine you're given the string test. Identify the character that corresponds to the index 6.

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 7
We're sorry to hear that something went wrong. What happened?
some-alt