Taking a Vacation: Transportation



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'
    print 'cost'


"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:


Yeah it helped...problem solved ty!!


No problem! Happy coding! :smiley:


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