Taking a vacation. helpppp


#1



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

Oops, try again. It looks like rental_car_cost returns None instead of the correct amount (40) for 1 days.


 def rental_car_cost(days):
    daily = 40 * days
    if days >= 7:
        daily /= 50
    elif days >= 3:
        daily /= 20
        return daily

OK so, idk wtf to do, honestly im completely lost. What should be the sign for deduction? How do i represent that everyday $40 is added.. i feel so dumb :frowning:


#2

We need to subtract 50, not divide by it.


#3

is it this? -= .... i honestly
dont remember


#4

Yes. We use that compound operator for subtraction. The result of daily - 50 is assigned back onto daily.

daily -= 50

#5

def rental_car_cost(days):
    daily = 40 * days
    if days >= 7:
       daily -= 60
    elif days >= 3:
        daily -= 20
        return daily

Oops, try again. It looks like rental_car_cost returns None instead of the correct amount (40) for 1 days.
:frowning: i am bad at coding..


#6

Because your return-statement is part of the elif-branch ... daily will be return only if days >=3 and days < 7.
You have to change the indent of the return-statement :smiley:


#7

THANK YOU SOO MUCH!!! HUGG. I made such a small mistake..


#8

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