Taking a vacation

Lesson 01/07 – Before We Begin

 
def answer ():
    return 42

Lesson 02/07 – Planning Your Trip

 
def hotel_cost (nights):
    return 140 * nights

Lesson 03/07 – Getting There

 
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

Lesson 04/07 – Transportation

 
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 < 3:
        return 40 * days
    elif days > 6:
        return 40 * days - 50
    else:
        return 40 * days - 20

Lesson 05/07 – Pull it Together

 
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 < 3:
        return 40 * days
    elif days > 6:
        return 40 * days - 50
    else:
        return 40 * days - 20
def trip_cost (city, days):
    return rental_car_cost(days) + hotel_cost (days) + plane_ride_cost (city)

Lesson 06/07 – Hey, You Never Know!

 def cube(n):
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 < 3:
        return 40 * days
    elif days > 6:
        return 40 * days - 50
    else:
        return 40 * days - 20
def trip_cost (city, days, spending_money):
    return rental_car_cost(days) + hotel_cost (days) + plane_ride_cost (city) + spending_money

Lesson 07/07 – Plan Your Trip!

 
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 < 3:
        return 40 * days
    elif days > 6:
        return 40 * days - 50
    else:
        return 40 * days - 20
def trip_cost (city, days, spending_money):
    return rental_car_cost(days) + hotel_cost (days) + plane_ride_cost (city) + spending_money

print trip_cost ("Los Angeles", 5, 600)