Course Content
Python Data Types
Python Data Types
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.
string = 'watermelon' length = len(string) print(f'the length of the string "{string}" is {length}')
Swipe to show code editor
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.
Thanks for your feedback!
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.
string = 'watermelon' length = len(string) print(f'the length of the string "{string}" is {length}')
Swipe to show code editor
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.
Thanks for your feedback!
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.
string = 'watermelon' length = len(string) print(f'the length of the string "{string}" is {length}')
Swipe to show code editor
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.
Thanks for your feedback!
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.
string = 'watermelon' length = len(string) print(f'the length of the string "{string}" is {length}')
Swipe to show code editor
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.