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:全局名稱‘numKilos’沒有定義」我不知道爲什麼它說numKilos ISN」定義。 numKilos等於用戶輸入的數字。NameError:全局名稱「numKilos」沒有定義
請添加一個語言標記。 – SLaks