-4
これは、旅行のコストを返すPython関数です。私は何が間違っているのか理解できません。何も呼ばれません。何か不足していますか?Python - 関数を呼び出す
def hotel_cost(nights):
return 140 * nights
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):
total_car = days * 40
if days >= 7:
total_car -= 50
elif days >= 3:
total_car -= 20
return total_car
def trip_cost(city, days):
return rental_car_cost(days) + plane_ride_cost(city) + hotel_cost(days)
print trip_cost("Charlotte", 6)
あなたはインデントの問題を抱えているを追加しました。最後の行をインデントしてはいけません。 –
それはそれを修正しません.. – Merialc
結果を印刷するのを忘れているかもしれません。 'print(trip_cost())'を試してください –