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
,让我重做这个功能。
我在这里做错了什么?