Transportation


#1
 def rental_car_cost(days):
    rental == 40 * days
    if days >= 7:
        rental - 50
    elif days >= 3: 
        rental - 20
    return rental

I keep getting a "did you create a function for rental_car_cost?"

Not sure what I am doing wrong here...



#2

here:

rental == 40 * days

why would you use two equal signs? which means: check if rental (which is undefined) equals 40 * days

also, what you are currently doing won't update rental. For inspiration, look at the code below:

i = 10
print i // 10
print i - 5 // 5
print i // 10, see? no change
i = i - 5 // now we update i
print i // 5

#3

It all makes more sense. Thanks!


#4

Well, the question says "if you rent the car for 3 or more days, you get $20 off your total." key word MORE. You need to make sure that an individual cannot qualify for both discounts. 7+ days and 3-6 days.


#5

your two "rental" sections need to be -= (minus, equal) so the program knows knows to only return the 50%, or the 20% discount.


#6

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