5/7 Oops, try again. Your code looks a bit off. Feel free to peek back at earlier exercises if you need a refresher! Take a look at the console window for the error message from the interpreter


#1

I really dont know whats wrong but i keep getting the error message: Oops, try again. Your code looks a bit off. Feel free to peek back at earlier exercises if you need a refresher! Take a look at the console window for the error message from the interpreter.

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

    else 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_c
def trip_cost(city, days):
    return rental_car_cost(days) + hotel_cost(nights) +plane_ride_cost(city)

Thanks for helping me out! ( DO IT OR ILL FEED YOU TO THE DUCKS :smirk_cat: )


#2

The trip cost function has three arguments

def trip_cost(city,days,spending_money):

hence your implementation should be

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

#3

thanks for that suggestion but now i get this


#4

look this:

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