我試着使用鍵盤輸入來創建一個假的計算器,但是當我運行的代碼我得到:Python 3的打印功能
<function trip_cost at 0x01FF3348>
我的代碼是:
city = input("What city will you vacation at?")
days = input("How many days will you be staying there?")
def hotel_cost(days):
return 140 * days
def plane_ride_cost(city):
if city == "Charlotte":
return 183
elif city == "Tampa":
return 220
elif city == "Pittsburgh":
return 222
elif city == "Los Angeles":
return 475
def rental_car_cost(days):
cost = 40 * days
return cost
def trip_cost(city, days):
return plane_ride_cost(city) + rental_car_cost(days) + hotel_cost(days)
print (trip_cost)
我怎樣才能得到它要退還它將花費的金額?
感謝
好的,謝謝 – OceanS
@OceanS如果這回答了你的問題,請點擊箭頭下方的勾號來接受它。 – EpsilonX