Theeaxe

My Vacation: Codecademy Course - Functions

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