def inputKilos():
while True:
numKilos = float(raw_input("Enter a number of Kilometers. Enter 0 to end program. "))
if numKilos == 0:
break
else:
convert_kilos(numKilos)
return
def convert_kilos(numKilos):
numMiles = numKilos * 0.6214
print_output()
return
def print_output():
print numKilos, "kilometers eqauls", numMiles, "miles."
def main():
inputKilos()
main()
当我尝试运行程序时,它显示“ NameError: global name 'numKilos' is not defined ” 我不知道为什么它说 numKilos 没有定义。numKilos 等于用户输入的数字。