counter = 0
for i in len(s):
if i in ('a','e','i','o','u'):
counter += 1
print("Number of vowels:" + str(counter))
Run Code Online (Sandbox Code Playgroud)
我正在尝试制作一个程序来计算元音的数量,假设它s是一个预定义的字符串。但我收到一个错误:
“int”对象在python中不是可迭代的错误
python-3.x ×1