7/7, kinda stuck. solution please?


#1

well. here is my code. all the other parts i understand. but at the end (the 'print trip cost("Los Angeles", 5, 600)' bit), i get completely lost. reason for complete lostness? when i click the 'save and submit code' button, i get this message:
Oops, try again. It looks like nothing was printed to the console!
my question is, why is this happening? and how can i stop it from happening?!

def hotel_cost(night):
return (140 * night)

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

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

print trip_cost("Los Angeles", 5, 600)


#2

The correct code is:

def plane_ride_cost(city):
if city == "Charlotte":
return 183
if city == "Tampa":
return 220
if city == "Pittsburgh":
return 222
if city == "Los Angeles":
return 475

def rental_car_cost(days):
cost = 40 * days
if days >= 7:
cost -= 50
return cost
elif days >= 3:
cost -= 20
return cost
else:
return cost

def hotel_cost(nights):
return 140 * nights

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

def double(city):
return 2 * city

def add(days,city):
return double(days) + double(city)

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

print trip_cost("Los Angeles", 5, 600)


#3

Have you indented the last line correctly. Makes a world of difference and sounds like something that could lead to that error in this case.


#4

i have tried your suggestion but then this came up: oops! have you accidently deleted the trip_cost function?
and also this came up:
File "python", line 16
if days >= 7:
^
IndentationError: unindent does not match any outer indentation level

the only change i made was to indent the last line, which is not line 16. why has this happened?