Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Accessing String Elements | Basic Concepts
String Manipulation in Python
course content

Kursinnhold

String Manipulation in Python

String Manipulation in Python

1. Basic Concepts
2. String Methods
3. Strings Formatting

book
Accessing String Elements

Now we know how we can create a string: both single and multiline. Now we need to learn how can we access certain elements in the string.

Elements in a string can be accessed by using indices. The very first index is 0, not 1. Therefore, if a string has 10 elements, the very last index will be 9.

Oppgave

Swipe to start coding

Given variable course with the string String Manipulation in Python. Your tasks are:

  1. Extract the element with index 7.
  2. Extract the 12th element.

Løsning

Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 3
toggle bottom row

book
Accessing String Elements

Now we know how we can create a string: both single and multiline. Now we need to learn how can we access certain elements in the string.

Elements in a string can be accessed by using indices. The very first index is 0, not 1. Therefore, if a string has 10 elements, the very last index will be 9.

Oppgave

Swipe to start coding

Given variable course with the string String Manipulation in Python. Your tasks are:

  1. Extract the element with index 7.
  2. Extract the 12th element.

Løsning

Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 3
Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Vi beklager at noe gikk galt. Hva skjedde?
some-alt