How to print the trip_cost?


def hotel_cost(days):
return 140*days
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
return "No flights available"
def rental_car_cost(days):
if days<3:
return days*40
elif days>=3 and days<7:
return (days*40)-20
return (days*40)-50
def trip_cost(city,days):
return rental_car_cost(days)+ hotel_cost(days)+ plane_ride_cost(city)
x=input("number of days you want to stay in the Hotel:")
y=raw_input("enter the city you wanto go:")
z=input("number of days you want to rent a car for:")
print "%d$"%hotel_cost(x)
print "%s$"%(plane_ride_cost(y))
print "%d$"%rental_car_cost(z)


Ok so, I don't know about all this above. But, what I can tell you is just how to print out trip_cost the boring way :stuck_out_tongue: So, obviously, print then your function trip_cost then in your parameters you wanna put in what the instructions require you to do, " print out the trip_cost( to "Los Angeles" for 5 days with an extra 600 dollars of spending money." In this way, your print statement should look something like this basic example:

print function("city", days, money)


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