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

bookStrings 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
Opgave

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

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 3. Kapitel 8
single

single

Spørg AI

expand

Spørg AI

ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

Suggested prompts:

Opsummér dette kapitel

Explain code

Explain why doesn't solve task

close

Awesome!

Completion rate improved to 3.85

bookStrings Have Length

Stryg for at vise menuen

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
Opgave

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 desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 3. Kapitel 8
single

single

some-alt