Vacation Price Program Python
I am doing a project in code academy and I have to make a program that adds up all the vacation cost (like travel, city, ...etc). I am not sure what wrong with my code. def hotel_
Solution 1:
Your trip_cost
is messed up. It never calculates total_cost
, and tries to call a nonexistent function. Here's my guess on what you meant:
def trip_cost(city, days):
nights = days - 1
total_cost = plane_ride_cost(city) + rental_car_cost(days) + hotel_cost(nights)
return total_cost
Solution 2:
Sorry this is late, it's meant for those that will need help in the future.
The right script Codeacademy was most likely looking for is as follows:
def trip_cost(city,days):
totalcost=plane_ride_coast(city)+rental_car_cost(days)+hotel_cost(days)
return totalcost
Codeacademy assumes that the # of days the car was rented(rental_car_cost) is equal to the # of nights that were stayed(hotel_costs), because of this only two parameters were needed(city, days) and not the third(nights).
I hope this helped.
Post a Comment for "Vacation Price Program Python"