Transportation


#1



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


Oops, try again. It looks like rental_car_cost returns None instead of the correct amount (40) for 1 days.


Replace this line with your code.


#2

your return statement is on the wrong indentation level


#4

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 = days * 40
    if days >= 7:
        cost -= 50
    elif days >= 3:
        cost -= 20
            return cost

Oops, try again. Your code looks a bit off. Feel free to peek back at earlier exercises if you need a refresher! Your code threw the following error: unexpected indent (python, line 20)


#5

It should be aligned to cost -= 20

elif days >= 3:
        cost -= 20
        return cost

#6

Still its shows an error.
Anyway thanks, I found another solution.


#7

it should be like

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

#8

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