Quotes help make search much faster. Example: "Practice Makes Perfect"

Tuesday, November 27, 2012

Codecademy: Pull It All Together


#sample solution


def hotelCost(days):
    return 140*days

def planeRideCost(city):
    if city == "Charlotte":
        return 183
    if city == "Tampa":
        return 220
    if city == "Pittsburgh":
        return 222
    if city == "Los Angeles":
        return 475

def rentalCarCost(days):
    cost = days*40
    if days >= 7:
        cost -= 50
    elif days >= 3:
        cost -= 20
    return cost

def tripCost(city,days):
return rentalCarCost(days) + planeRideCost(city) + hotelCost(days)

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts