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

Swipe to show menu

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
Task

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.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 8
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

close

Awesome!

Completion rate improved to 3.85

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
Task

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.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

close

Awesome!

Completion rate improved to 3.85

Swipe to show menu

some-alt