1. Home
  2. Python
  3. Python Examples
  4. Python – Find String Length

Python – Find String Length

Python Program to Find Length of a String

Q. Write a Python program to take user input and calculate length of a string.

Use built in len() Python function to calculate the length of a string.

This function take one argument of type object. If the input object is a string, this function will calculate length of a string.

Example:

Output

8

Example with User Input

Another Python program to take input of string from user and calculate the length.

Execute above Python script. enter a string when prompt and program will print the length of string.

Tags ,
Was this article helpful to you? Yes No
Advertisement