6. Hey, You Never Know!


#1

Can anyone see the problem with this? It says there is an invalid syntax on line 5

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

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


#2

Line 25* sorry there shouldn't be any issue as it looks correct maybe there is an issue with python


#3

hotel cost(days) -------> should be hotel_cost(days)


#4

The issues may be related to rental_car_cost(days) part.
change it as below and check if it works for you.

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