runnig

Untitled

Sep 4th, 2015
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 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.     cost = 40 * days
  16.     if days>=7:
  17.         cost -= 50
  18.     elif days >=3:
  19.         cost -= 20
  20.     return cost
  21.  
  22. def trip_cost(city,days,spending_money):
  23.     return (hotel_cost(days) + plane_ride_cost(city) + rental_car_cost(days) + spending_money)
  24.  
  25. print(trip_cost("Tampa", 3, 111))
  26. print(trip_cost("Los Angeles" , 5 , 600))
Advertisement
Add Comment
Please, Sign In to add comment