Rental car


#1

Hi!, please help anyone know what i'm doing wrong?
this my code

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

and this is the error: 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 18)


ERROR It looks like rental_car_cost returns -10 instead of the correct amount (40) for 1 days
#2

your if/elif/else statements should be on the same indentation level, i.e

if condition:
    #if block
elif condition:
    #elif block
else:
    #default

#3

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