Python program to calculate the length of a string without using a library function |count length of string without using a library function |
Python program to calculate the length of a string without using a library function
This Example helps how to count string length without using any library function . user can input any string and output given length of the string
Python program to calculate the length of a string without using a library function |
str=input("Enter string :")
count=0
for i in str:
count=count+1
print("Length of the string:")
print(count)
count=0
for i in str:
count=count+1
print("Length of the string:")
print(count)
Output -
Enter string :Hello
Length of the string:
5
Length of the string:
5
Post a Comment