codescracker


python

Python Program to Find Length of String



« Previous Program Next Program »


Find Length of String in Python

To find length of any string in python, you have to ask from user to enter any string and then find the length of that string using the len() function as shown in the program given below.

Python Programming Code to Find Length of String

Following python program ask from user to enter a string and find the length of that string:

# Python Program - Find Length of String
		
while True:
	print("Enter 'x' for exit.")
	string = input("Enter string: ")
	if string == 'x':
		break
	else:
		print("Length of string =", len(string),"\n")

Here is the sample run of the above Python program:

python find length of string

Same Program in Other Languages

You may also like to learn or practice the same program in other popular programming languages:


« Previous Program Next Program »




Tools
Calculator

Quick Links
Signup - Login - Give Online Test