Indentation error


#1



File "python", line 16
if days>=7:
^
IndentationError: unexpected indent


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


#2

Your if/elif statements should be on the same indentation level as your rental_car_cost variable,

rental_car_cost = 40 * days
if days>=7:
    rental_car_cost -= 50
elif days>= 3:
    rental_car_cost -= 20
elif days>=3 and days>=7:
    rental_car_cost -= 70

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.