Taking a Vacation: Error


#1

Hello, can you show me where my code is broken ?

I get this error :File "python", line 19
return total = total - 50
^
SyntaxError: invalid syntax

This is my code:

def rental_car_cost(days):
car_cost = 40
total = car_cost * days
if days >= 7:
return total = total - 50
else days >= 3:
return total = total - 20
return total
I have already tryied with cost == 40, I get the same error. Thank you for your time


Taking a vacation 8. unexpected error
#2

and if I do it like this

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


#3

Yeah I'm also getting the same error.


#4

I guess this is your answer.
def rental_car_cost(days):
c_cost = days * 40
if days >= 7:
c_cost -= 50
elif days >= 3:
c_cost -= 20
else:
c_cost
return c_cost


#5

Look at my code, I hope it will be helpfull


#6

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