Monday, 9 September 2013

#EANF#

#EANF#

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_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
Also, any advice on how to make my code less redundant and clean.

No comments:

Post a Comment