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): if days>=7: return days*40-50 elif (days >=3) and (days<7) : return days*40-20 else : return days*40 def trip_cost(c, d): return rental_car_cost(d) + hotel_cost(d) + plane_ride_cost(c)
Looks like it is inside the rental_car_cost code block. Needs to be against left margin.
The variable names may be okay, the exercise expects
The upper bound has already been tested. No need for
and days < 7. There is repetition in the code that can be simplified...
cost = days * 40
Now just test the
>= 7 and
>= 3 cases and apply the discount to cost.
cost -= 60
We don't need an
if ___: elif ___: return cost
hhhhhhhhhhhhh the problem was that there is a space before Def trip_cost(c,d)
thank you for your help :* :* :*
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.