Wednesday, July 30, 2014

Day 116

Python at CodeCademy. Worked on Python tutorial 4 of 7, Taking a Vacation: Transportation!
Worked on more defining functions that accept strings as an arguments.

The code used:
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 >= 3:
        return days * 40 - 20
    else:
        return days * 40

There was no interaction for this code:

No comments:

Post a Comment