Hey, you never know!... Yeah and you won't tell me what to know


#1

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

So this is my code and I'm getting a VARIETY of errors, so I will tell you a few of the things they have claimed are wrong with this:
1.Oops, try again. trip_cost('Tampa', 4, 49) returned 920 instead of the correct value 969
2.Oops, try again. trip_cost('Tampa', 4, 48) returned 920 instead of the correct value 968
3.Oops, try again. trip_cost('Los Angeles', 1, 68) returned 655 instead of the correct value 723
4.Oops, try again. trip_cost('Charlotte', 0, 48) returned 183 instead of the correct value 231
5.Oops, try again. trip_cost('Tampa', 6, 94) returned 1280 instead of the correct value 1374
6.Oops, try again. trip_cost('Los Angeles', 9, 15) returned 2045 instead of the correct value 2060
etc, etc, etc. over and over with different numbers and cities. I really have NO idea what to do with this... :-1::thumbsdown:


#2

Hi, @agriggs11 ,

You have ...

return hotel_cost(days) + plane_ride_cost(city) + rental_car_cost(days)

There's nothing in there about the money variable. Notice that the message here ...

Oops, try again. trip_cost('Tampa', 4, 49) returned 920 instead of the correct value 969

... reports an amount returned that is 49 less than the correct value. The argument passed to the money parameter was also 49. A similar pattern occurs for all the other messages that you listed.


#3

wait so what does that mean? what am I supposed to do??


#4

Include money in the total that the trip_cost function returns.


#5

ohhhhhh yeah it worked thank you


#6

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