Plan your trip help


except for ("Los Angeles", 5, 600) for everything else
It is printing " Oops, try again. It looks like the correct value (1955) was not printed."
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_car_cost = 40 * days
   if days >= 7:
        return rental_car_cost - 50
   elif days >= 3 and days < 7:
        return rental_car_cost - 20
        return rental_car_cost
def trip_cost(city,days,spending_money):
    return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city) + spending_money
print (trip_cost("Los Angeles", 2, 600))


I just tested!
It works fine for me.
Try Change browser or deleting cache history or zooming(browser)!


It looks like your indentations are off. If they aren't off, then go ahead and refresh the page. It should work for you.


changed the browser, deleted cache history still the same result.


corrected the indentations but still getting the same result.


Okay. After running through this again, I believe I found the problem here. The instructions say this:

After your previous code, print out the trip_cost( to "Los Angeles" for 5 days with an extra 600 dollars of spending money.

Let me emphasize a number here. 5 days. Now, if we look at your final line of code, you have the following: print (trip_cost("Los Angeles", 2, 600)). The 2 = days. How many days did the instructions ask for?

Once you made the switch, go ahead and let me know if it worked.


Ok now I understood what the problem was.
Since the instructor has asked only for ( "Los Angeles", 5, 600 ) and not for other simulations that I have been performing that's why it was giving me error.


print trip_cost("Los Angeles", 5, 600)
You only need one set of parentheses, including changing 2 to 5, as someone else already mentioned.


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