Computer Science, asked by uneha66, 1 year ago

Write a Python program to find length of the string .using Len()

Answers

Answered by navneetajha77
3

Explanation:

First we will see how to find the length of string without using library function len(). Here we are taking the input from user and counting the number of characters in the input string using for loop.

# User inputs the string and it gets stored in variable str

str = input("Enter a string: ")

# counter variable to count the character in a string

counter = 0

for s in str:

counter = counter+1

print("Length of the input string is:", counter)

Output:

Enter a string: Beginnersbook

Length of the input string is: 13

Answered by sanjayjha65
1

Answer:

Explanation:

Len () is used for find the length of the string

Similar questions