4. Transportation


#1


I keep getting the message "Oops, try again. An error was raised for rental_car_cost(1): global name 'cost' is not defined."

I'm not sure where I've gone wrong- if someone could please explain? Thanks.


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


#2

'==' is a comparison operator.

If you need to save something in an identified(variable),you need to use assignment operator. ( =)


#3

Ok, perfect- it worked! Thank you!


#4

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