I keep getting an error message that says; “Make sure to define a function named trip_cost”, but I think i’ve done everything that the exercise asked for.
return 140 * nights
if city == “Charlotte”:
elif city == “Tampa”:
elif city == “Pittsburgh”:
elif city == “Los Angeles”:
cost = 40 * days
if days >= 7:
cost -= 50
elif days >= 3:
cost -= 20
def trip_cost(city, days):
return hotel_cost(days - 1) + plane_ride_cost(city) + rental_car_cost(days)
Try calling it yourself. If it’s there you can call it.
And then, if it’s not there, you can start out with a simple function that you call:
You’d run that, verify that you’ve successfully defined a function. Then you’d start turning that into your other function one piece at a time, verifying that you haven’t yet broken it.
During this you may simply fix the issue, in which case you need to compare what was different and consider how you could have identified it yourself immediately.
Or you’d run into the same issue again, but this time it would be during a small change and you’ll be able to tell what that change was which breaks it.
See it as an exercise in comparison and debugging.