Hey, you never know!... why this isnt working. any help? lol


#1
indent preformatted text by 4 spaces

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):
if days >= 7:
return 40 * days - 50
elif days >= 3:
return 40 * days - 20
elif days < 3:
return 40 * days

def spending_money(cash):
return 50 * days

def trip_cost(city, days, trip_cost):
return hotel_cost(days) + plane_ride_cost(city) + rental_car_cost(days)

print trip_cost("Tampa", 8, spending_money)

returns errors like:

Oops, try again.
trip_cost('Charlotte', 7, 10) returned 1393 instead of the correct value 1403

cities and values show at random every time i click save & submit


#2

Because you forgot to use the variable trip_cost in your trip_cost function.


#3

def spending_money(cash):
return 50 * days

def trip_cost(city, days, trip_cost):
return hotel_cost(days) + plane_ride_cost(city) + rental_car_cost(days)

print trip_cost("Tampa", 8, spending_money)

returns errors like: