给定一个字符串,然后判断该字符串的长度。
## 实例 1:使用内置方法 len()
str = "qwerty"
print(len(str))
输出结果为:
6
## 实例 2:使用循环计算
def findLen(str):
counter = 0
while str[counter:]:
counter += 1
return counter
str = "qwerty"
print(findLen(str))
输出结果为:
6