Please help me to correct my code


It is throwing error message Oops, try again. It looks like rental_car_cost returns 96.0 instead of the correct amount (100) for 3 days.

Correct amount of rental car should display

Replace this line with your code.


How do we help you without your code?

the exercise url is the same for everyone, please copy paste your full code to the forum

also, use markup:

so your indention will show


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.

Code :

def rental_car_cost(days):
    if days >= 7:
        return total
    elif days >=3:
        return total
    else :
        return rate



why such complicated math? in your if statement, just subtract 50, in your elif statement, just subtract 20


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