<分区>
当我尝试在 Python 3.0 中使用任何可能的输入字符串执行以下代码时,出现 NameError:
def onePerLine(str):
for i in str:
print(i)
word=input("Enter a phrase or word: ")
onePerLine(word)
错误如下:
Enter a phrase or word: hello
Traceback (most recent call last):File"C:\Users\R\Documents\Python30\func2.py",line 5, in <module> word=input("Enter a phrase or word: ")
File "<string>", line 1, in <module>
NameError: name 'hello' is not defined
我该如何解决这个问题并让我的代码运行? PS:我是 python 和一般编程的新手。任何援助将不胜感激。