Last active
August 29, 2015 14:11
-
-
Save biwin/0ae469fef114ccf11cb3 to your computer and use it in GitHub Desktop.
Taking a Vacation - codeacademy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hotel_cost(nights): | |
return 140 * nights | |
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 | |
def rental_car_cost(days): | |
if days >= 7: | |
return (days * 40)-50 | |
elif days > 2 and days < 7: | |
return (days*40) - 20 | |
else: | |
return days * 40 | |
def trip_cost(city, days, spending_money): | |
return rental_car_cost(days) + plane_ride_cost(city) + hotel_cost(days) + spending_money | |
print trip_cost("Los Angeles", 5, 600) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment