Find String Length without using built in functions

Find the length of a string without using built in function in Python

# Taking input from the user
userinput=input("Enter your string: ")
n = 0

# iterating over each element in the string entered by the user
# and adding +1 the total length
for char in userinput:
    n += 1

print("The length of the string is =",n)
Output :

Enter your string: fundaofwebit
The length of the string is = 12

© Copyright - 2018 - 2021 | All rights reserved at Funda of Web IT