5. Pull it together help me with this error!


#1

def hotel_cost(nights):
    return nights * 140
    

def plane_ride_cost(city):
    if city == "Tampa":
        return 220
    elif city == "Los Angeles":
        return 475
    elif city == "Pittsburgh":
        return 222
    elif city == "Charlotte":
        return 183


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

def trip_cost(city, days):
   return plane_ride_cost('Los Angeles') + hotel_cost(3) 
+ rental_car_cost(3)

It keeps giving me a bug like this

Oops, try again. trip_cost('Charlotte', 8) returned 895 instead of the correct value 1573


#2

Check your math. Your code is fine. :slight_smile:


#3

in your trip_cost function, use the function parameters so then on function call you can supply the number of days and the destination.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.