Taking a Vacation: Transportation


#1



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


It says rental_car_cost returns none instead of correct amount (40) for 1 day


def rental_car_cost(days):
    rent = 40*days
if 'days' >= 7:
    print '40*days -= 50'   
elif 'days' >= 3:
    print '40*days -= 20'
else:
    return40*days
    print 'cost'


#2

"Calculate the cost of renting the car" So your first problem is that instead of rent you need cost. Secondly, you do not have to put anything in ' ' that is not necessary. Thirdly, you are not printing anything. After the if, elif, and else statement you have the days equation then under that the cost equation. Finally, in your else statement, you do want to return something at the end but not print anything. Also, since python is so particular about their spacing and punctuation make sure you are correctly spacing and punctuating everything. So here is the basic outline for your code:

def rental_car_cost(days):
    cost = days * 40
    if days >= 7:
        cost what
    elif days >= 3:
        cost what
    return what

This should get you started on the right track and enable you to figure out whats missing! :smiley:


#3

Yeah it helped...problem solved ty!!


#4

No problem! Happy coding! :smiley:


#5

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