Python Program to find a String Length

Write a Python Program to find a String Length using the built-in len function with practical examples.

Python Program to find a String Length

The program finds the string length using the len function.

Please refer String article to understand everything about them in Python.

str1 = "Tutorial Gateway"

print("Total Length of a Given String = ", len(str1))
Total Length of a Given String =  16

This Python program is the same as the first example. However, this time, we are allowing the user to enter their own string.

str1 = input("Please enter your own String : ")

print("Total Length of a Given String = ", len(str1))
Python Program to find a String Length 2