从这个源代码:
def numVowels(string):
string = string.lower()
count = 0
for i in range(len(string)):
if string[i] == "a" or string[i] == "e" or string[i] == "i" or \
string[i] == "o" or string[i] == "u":
count += 1
return count
print ("Enter a statement: ")
strng = input()
print ("The number of vowels is: " + str(numVowels(strng)) + ".")
运行时出现以下错误:
Enter a statement:
now
Traceback (most recent call last):
File "C:\Users\stevengfowler\exercise.py", line 11, in <module>
strng = input()
File "<string>", line 1, in <module>
NameError: name 'now' is not defined
==================================================