In this example we will show how to count the length of a string without using a library function.
Source Code
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
str = input("Please input the string: ")
length = 0
for i in str:
length += 1
print("The length is: ", length)
Output:
Please input the string: Hello World
The length is: 11