lundi 5 octobre 2015

What is wrong with my Python code on codecademy?

I am currently learning Python on codecademy and I am stuck. These are the directions:

"Below your existing code, define a function called rental_car_cost with an argument called days. Calculate the cost of renting the car: Every day you rent the car costs $40. if you rent the car for 7 or more days, you get $50 off your total. Alternatively (elif), if you rent the car for 3 or more days, you get $20 off your total. You cannot get both of the above discounts. Return that cost."

The following is the code I have:

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

    elif days >= 3:
        cost -= 20

    return cost

When I try to save and submit this code it gives me the error:

"Oops, try again. Did you create a function called rental_car_cost?"

Does anyone know what I am doing wrong?????? Please help!

Aucun commentaire:

Enregistrer un commentaire