Here is my code. The problem is not in my code, cause it seems to work fine. I just can’t understand how they can change the nights in hotel_cost(nights) to hotel_cost(days - 1) in total_cost and still come up with the right amount. The cost of 1 night is defined with 140 dollar. But the cost of 2 days is not defined with 140 dollar. I just want to understand why and how they can change the arguments without any difficulty or a wrong outcome. Can anyone explane?
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: cost -= 50 elif days >= 3: cost -= 20 return cost def trip_cost(city, days, spending_money): return rental_car_cost(days) + hotel_cost(days - 1) + plane_ride_cost(city) + spending_money print trip_cost("Los Angeles", 5, 600)