Advertisement
Guest User

python

a guest
Feb 26th, 2015
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. def hotel_cost(nights):
  2.     return 140 * nights
  3.  
  4. def plane_ride_cost(city):
  5.     if city == "Charlotte":
  6.         return 183
  7.     elif city == "Tampa":
  8.         return 220
  9.     elif city == "Pittsburgh":
  10.         return 222
  11.     elif city == "Los Angeles":
  12.         return 475
  13.  
  14. def rental_car_cost(days):
  15.     if days >= 7:
  16.         return 40 * days - 50
  17.     elif days >= 3:
  18.         return 40 * days - 20
  19.     else:
  20.         return 40 * days
  21.  
  22. def trip_cost(city, days, spendingmoney):
  23.     return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city) + spendingmoney
  24.    
  25. print trip_cost("Los Angeles", 5, 600)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement