Python 4/7


#1

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

Please ignore indention.

Any issue for the description for
"elif days >=3 and <7: " ?

If shows error for this line.

Thank you


#2

def rental_car_cost(days):
cost = days * 40
if days >= 7:
cost = cost - 50

elif days >=3 and days <7:
        cost = cost -20
return  {'days':days ,'cost':cost}

print rental_car_cost(1)
print rental_car_cost(2)
print rental_car_cost(3)
print rental_car_cost(4)
print rental_car_cost(5)
print rental_car_cost(6)
print rental_car_cost(7)
print rental_car_cost(8)


#3

you dont need the 'and <7' inside of the elif statement since if days is >= 7 it does the first function. elif which checks and makes sure its not >= 7 and if its not it goes to the elif code and checks if days >=3 so if days <7 it will go to the elif code

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