Hey, You never know!


#1


Hello,

I am stuck at the Hey, you never know code.
I get the right results, but always an error message like this Oops, try again. tripcost('Charlotte', 5, 68) returned 1063 instead of the correct value 1131_for some calculations i in the backround ...

Thanks for advice!

Here is my code

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
print hotel_cost(4), plane_ride_cost("Charlotte")

def rental_car_cost(day):
    costs =  40 * day
    if day >= 7:
        costs = (40 * day) - 50
        
    elif day >= 3:
        costs = (40 * day) - 20 
    return costs
#print rental_car_cost(4)

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

print trip_cost("Los Angeles", 4, 50)


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


Error:
Oops, try again. trip_cost('Charlotte', 5, 68) returned 1063 instead of the correct value 1131


Replace this line with your code.



Replace this line with your code.


#2

You are just to add spending_money with no argument.

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

#3

It also has to be on the same line.


#4

I believe that's what I did.

Maybe we should let the OP respond. :slight_smile:


#5

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