私はコードアカデミーでプロジェクトを行っており、すべての休暇費用 (旅行、都市など) を合計するプログラムを作成する必要があります。コードの何が問題なのかわかりません。
def hotel_cost(nights):
return nights * 140
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):
if days < 3:
return 40 * days
elif days >= 3 and days < 7:
return days * 40 - 20
elif days >= 7:
return days * 40 - 50
def trip_cost(city,days):
city = plane_ride(city)
days = rental_car_(days) + hotel_cost(nights)
return total_cost(city + days)
また、私のコードを冗長でクリーンにする方法についてのアドバイス。