Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Strings Have Length | Strings
Python Data Types
course content

Kursinnhold

Python Data Types

Python Data Types

1. Numeric Types
2. Boolean Type
3. Strings

book
Strings Have Length

There is also a very useful function in Python that can give the length of a string -- len() function. Let's look at the example of using this function.

123
string = 'watermelon' length = len(string) print(f'the length of the string "{string}" is {length}')
copy
Oppgave

Swipe to start coding

You have such strings apple,grape, orange. You have to get the length of each of these strings. Using such comparison operators >, < determine the longest string.

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 3. Kapittel 8
toggle bottom row

book
Strings Have Length

There is also a very useful function in Python that can give the length of a string -- len() function. Let's look at the example of using this function.

123
string = 'watermelon' length = len(string) print(f'the length of the string "{string}" is {length}')
copy
Oppgave

Swipe to start coding

You have such strings apple,grape, orange. You have to get the length of each of these strings. Using such comparison operators >, < determine the longest string.

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 3. Kapittel 8
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