5/7 what's wrong?


#1

What's wrong in my code?
When I press Save and Submit the website says:
Oops, try again. trip_cost('Tampa', 6) raised an error: unsupported operand type(s) for -: 'str' and 'int' not like I understand a word of that sentence.

def hotel_cost(nights):
return 140 * nights

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 :
return cost - 50
elif days>= 3:
return cost - 20
else:
return cost

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

It would be very meaningful to me if someone helped me


#2

put a space between the ) and the +


#3

wrong post :neutral_face:


#4

It didn't work, is there anything else that's wrong?
Thank you for the help


#5

Your return cost should be "return cost -= 50" and "return -= ".

You are missing the '=' signs.


#6

Try to change:
def trip_cost(days,city):

to:

def trip_cost(city, days):

due to Codecademy have to check your code and they want it that way.