This is supposed to be right... but why is this wrong? Taking a Vacation Transportation


#1



Taking a Vacation - Transportation


It says "global name 'cost' not defined"


It's supposed to return cost, right? I think I defined 'cost'...


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


#2

here:

cost == days * 40

to define a variable use a signle equal sign to assign a value to a variable, two equals signs means check if equal


#3

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