def ask():
global name, loca
print "What's your name?"
name = raw_input('> ')
print "Where are you from?"
loca = raw_input('> ')
if name or loca == None:
print "Please enter valid details."
ask()
ask()
print "Alright, so you're " + name + ", from " + loca + "."
通过这个脚本,如果我的两个变量都为空,它将只打印最后一行。 如果我填写一个或两个,它会触发那个
if
,使我重新执行该函数。我在这里做错了什么?