Not Getting Proper Answer for Days=1 on Planning a Vacation


#1


link to code: https://www.codecademy.com/courses/python-beginner-P5YtY/1/3

Hey guys, my program is coming back with a result of 20 for days=1, but I'm not too sure how this is occurring. Here's my code for the transportation function.

Program is saying "It looks like rental_car_cost returns 20 instead of the correct amount (40) for 1 days". Let me know where the error is! Thanks.


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


#2

Did you mean to write,

elif days >= 3:

?


#3

Sigh....I noticed just after I posted it, but thank you for finding it and replying! Cheers!


#4

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