代码:
print("Starting...")
def test():
notare = input()
bote()
def bote():
if notare == "a":
print("b")
else:
print("c")
test()
错误:
Traceback (most recent call last):
File "test.py", line 13, in <module>
test()
File "test.py", line 5, in test
bote()
File "test.py", line 8, in bote
if notare == "a":
NameError: name 'notare' is not defined
python不会知道函数存在。。。 Python以有序的方式执行。。。这意味着您必须先声明函数,然后才能调用它
所以,为了你的问题。。 尝试将函数移到调用它的函数上方
像这样
相关问题 更多 >
编程相关推荐