7.plan your trip invalid syntax


it keeps saying invalid syntax for this code
f 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 = 40 * days
if days >= 7:
cost -= 50
elif days >= 3:
cost -= 20
return cost
def trip_cost(city,days,spending_money):
return hotel_cost(days) + rental_car_cost(days) + plane_ride_cost(city) + spending_money
print trip_cost("Los Angeles",5 days,600):

I looked at the other ones and they were all the same as mine apart from their code was correct! Could you help me.

Replace this line with your code.


Well it's definitely invalid syntax when you don't indent the code. Make sure we see the same thing as you do, otherwise I'm not sure what you think we are supposed to do with what you posted.

You might consider what you're doing around the line where the syntax error is reported, perhaps compare that something with some reference for how to do that something.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.