📜  在不使用 len 的情况下,python 中的字符串 acharacters 计数 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:36.531000             🧑  作者: Mango

代码示例1
# 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)