Can anyone tell me how can I get the length of a string without using the len() function or any string methods. Please anyone tell me as I\'m tapping my head ma
len()
You can get the length of the string with a for loop.
for
For example, instead of:
string=input("Enter a string") print(len(string))
Do this:
string=input("Enter a string") a=0 for letter in string: a=a+1 print(a)