Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara String Indexing in Python | Variables and Types in Python
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Introduction to Python (dev copy)

bookString 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
question mark

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

Select the correct answer

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 2. Capitolo 7

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

Suggested prompts:

Mi faccia domande su questo argomento

Riassuma questo capitolo

Mostri esempi dal mondo reale

bookString Indexing in Python

Scorri per mostrare il menu

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
question mark

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

Select the correct answer

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 2. Capitolo 7
some-alt