Taking a Vacation: 4 (Pull it together) problem


#1

Hi, here is my 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):
    if days >= 7:
        discount = 50
        cost = 40 * days - discount
        return cost
    elif days >= 3:
        discount = 20
        cost = 40 * days - discount
        return cost
    else:
        cost = 40 * days
        return cost

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

File "python", line 28
def trip_cost(city,days)
^
SyntaxError: invalid syntax

Can you tell me guys what I did wrong?


#2

Hi here

def trip_cost(city,days)

You missing a : After the def trip_cost()


#3

Oh, right. But now it says:

Oops, try again. trip_cost('Charlotte', 2) raised an error: global name 'nights' is not defined


#4

Here

rental_car_cost(nights)

You should put days instead of nights


#5

Right, it's working now. Thanks so much.