Q. Python Program to find length of a given string.


Here you will find an algorithm and program in Python programming language to find length of given string. First let us understand string in Python.

Explanation : The string is defined as an array of characters. The difference between a character array and a string is the string ends with a special character '\0'.

For Example : If the string is "hello", then the output will be 5.

Algorithm to find length of string


START
Step 1 : Take input in a variable
Step 2 : Find the length of the string using len function
Step 3 : Print length of string 
STOP

Python Program to Find the Length of a String

str1 = "Letsfindcourse"
print("Length of the string =",len(str1)) 

Output

Length of the string = 14