Pull it together


#1



Guys im stuck a little help?

https://www.codecademy.com/courses/python-beginner-P5YtY/1/4?curriculum_id=4f89dab3d788890003000096


-Oops, try again. trip_cost('Tampa', 5) raised an error: global name 'hotel_costs' is not defined
-Oops, try again. trip_cost('Pittsburgh', 5) raised an error: global name 'hotel_costs' is not defined
-Oops, try again. trip_cost('Tampa', 8) raised an error: global name 'hotel_costs' is not defined
-Oops, try again. trip_cost('Los Angeles', 5) raised an error: global name 'hotel_costs' is not defined


Replace this line with your 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):
    rental = 40 * days
    if days >= 7:
        return rental - 50
    elif days >= 3 and days < 7:
        return rental - 20
    else:
        return rental
    
def trip_cost(city, days):
    a = hotel_costs(days)
    b = plane_ride_cost(city)
    c = rental_car_cost(days)
    return a + b + c


#2

try returning
this
return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city)

rather than creating seperate variables (as they already exist further up in the code).
other than that remove the (s) from hotel_costs and call the function again, it will relate back to the previous variable with the new argument (days)


#3

@darkbrightstarshot, hotel_cost and hotel_costs are two different things


#5

according to the instructions on the page:
"It is completely valid to call the hotel_cost(nights) function with the variable days"
they are the same variable using different argument?
please correct me if im wrong?


#6

you are right, but that is not the point i wanted to make, your function is named hotel_cost, but when you call the function you use hotel_costS. That doesnt' work


#7

aaah i see whats happened, you replied to my reply rather than the OP, i misinterpreted your comment as shooting down my answer :stuck_out_tongue: apologies


#8

no, this is not your fault, i mixed it up. Sorry, i will fix it


#11

Noted. Merrci Beaucoup. Arigato Gozaimas.


#12