Codecademy Python Answers Taking A Vacation

codecademy-taking-a-vacation

Taking a Vacation 1/7 – Before We Begin

def answer():
    return 42

Taking a Vacation 2/7 – Planning Your Tip

def hotel_cost(nights):
    return 140*nights

Taking a Vacation 3/7 – 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

Taking a Vacation 4/7 – 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):
    cost = 40*days
    if days>=7:
        cost-=50
    elif days>=3:
        cost-=20
    return cost
        
  

Taking a Vacation 5/7 – 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):
    cost = 40*days
    if days>=7:
        cost-=50
    elif days>=3:
        cost-=20
    return cost
        
def trip_cost(city,days):
    return rental_car_cost(days)+hotel_cost(days)+plane_ride_cost(city)
    hotel_cost(nights)

Taking a Vacation 6/7 – Hey You Never Know

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

Taking a Vacation 7/7 – Plan Your Tip

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):
    cost = 40*days
    if days>=7:
        cost-=50
    elif days>=3:
        cost-=20
    return cost
        
def trip_cost(city,days,spending_money):
    return rental_car_cost(days)+hotel_cost(days)+plane_ride_cost(city)+spending_money
    hotel_cost(nights)
print trip_cost("Los Angeles",5,600)

Leave a Reply

Your email address will not be published. Required fields are marked *