Taking a Vacation: Transportation


#1

Please help me. I've looked at other Q&As, but nothing helped. This is the error:
File "python", line 20
return -= 50
^
SyntaxError: invalid syntax

here's my code:
def rental_car_cost(days):
cost = days*40
if days >= 7:
return -= 50
elif days >= 3 and days < 7:
return -= 20
elif:
return cost
print rental_car_cost(1)


#2

Missing variable this and the other return statement.


#4

so what do i have to do


#5

You've set cost to the computation of days times 40. There is your variable.

return cost - 50

or save the return to the last line,

# conditional
    cost -= 50
# conditional
    cost -= 20

return cost

#6

thanks. i already got it before you sent that


#7

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