Upload
profbnk
View
209
Download
8
Embed Size (px)
Citation preview
Python Programming
Lab 9
Plan your trip
def hotel_cost(nights):
""" Calculating cost with tariff of $140 / night """
return nights * 140
def plane_ride_cost(city):
""" returning price as per location """
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 = days * 40
if days >= 7:
cost = cost - 50
return cost
elif days >= 3:
cost = cost - 20
return cost
return cost
def trip_cost(city, days, spending_money):
sum = rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city) +
spending_money
return sum
print trip_cost("Los Angeles", 5 , 600)