I could use some help


#1



tps://www.codecademy.com/courses/python-beginner-P5YtY/1/3?curriculum_id=4f89dab3d788890003000096

File "python", line 18
SyntaxError: can't assign to operator

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.


before_discount_cost = 0

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


#2

here:

days * 40 = before_discount_cost

the left hand sight is the variable you store the result in, and the right hand side is the value stored in the variable, now look at your code again


#3

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