Stuck - Taking a Vacation


#1



Taking a vacaion lesson 5, I have some invalid syntax here but I'm not able to figure out what I'm doing wrong?? Seeking some tips please...

File "python", line 24
return rental_car_cost(days) + hotel_cost(days) +
^
SyntaxError: invalid syntax


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

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


#2

Hi the error come from here

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

you should remove the else statement and just keep the return cost like that

    elif days >= 3:
        cost = cost - 20
    return cost

#3

Thanks I made that change however I"m now seeing this message;

"Oops, try again. rental_car_cost(1) returned None instead of the correct value 40"

"""New Code"""

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:
cost = cost - 50
elif days >= 3:
cost = cost - 20
return cost
def trip_cost(city,days):
return rental_car_cost(days) + hotel_cost(days)
+ plane_ride_cost(city)


#4

inisde your def trip_cost() try to remove the space between return rental_car_cost(days) + hotel_cost(days) and + plane_ride_cost(city) like that

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