Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele String Indexing in Python | Variables and Types in Python
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

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 2. Luku 7

Kysy tekoälyä

expand

Kysy tekoälyä

ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

Awesome!

Completion rate improved to 1.64

bookString Indexing in Python

Pyyhkäise näyttääksesi valikon

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

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 2. Luku 7
some-alt