(Transportation) incomplete


#1

In the part that says Transportation, the instructions say


But how many days? Should I return the cost with a $ sign?


#2

You may test your code with a variety of days to see how each discount is applied (or not).

No. Just print the numbers themselves.


#3

Another question, do I print or return


#4

Return from the function, and print the call expression.

print(trip_cost(8))

I forget the name of the function, but you get what this means.


#5

Here is my finished code:

def hotel_cost(nights):
    return 140*nights
def plane_ride_cost(city):
    if city=="Charlotte":
        return 183
    if city=="Tampa":
        return 220
    if city=="Pittsburgh":
        return 222
    if city=="Los Angeles":
        return 475
def rental_car_cost(days):
    days_cost=40
    if days == 7 or days > 7:
        days_cost=days_cost*days
        days_cost=days_cost-50
        return days_cost
    elif days == 3 or days > 3:
        days_cost=days_cost*days
        days_cost=days_cost-20
        return days_cost
print(rental_car_cost(1))

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


#6

Indentation issue:

        return days_cost # remove one level of indentation

#7

@mtf Actually, @printcoder_eric is missing this:

else:     # branch to allow for days < 3
     return days_cost * days

But, @printcoder_eric I am sure to have seen this same code with the same problem just 15 mins back in some other thread (edit: found it). Please always create a thread for your problem. And do not post the same problem in multiple threads. Thanks! :slightly_smiling:


#8

@gaurangtandon


Oops, sorry i will try to remember that also, it worked now.


#9

We are forced to take five minutes out tracking down what may or may not be the lesson/exercise in question and often the correct category just to get a bearing on the question. As a result I work with what I see, not what is right. If members cannot see fit to provide a link to the ACTUAL exercise and post in the ACTUAL category, then I think I'm just going to quit answering questions. There is no more room for guess work, here.


#10

I agree with you. This is definitely a problem for us.


#11

@mtf

I'm no Codecademy Moderator, but I can see how that might be painstaking. Just trying here but is a link like this https://www.codecademy.com/courses/python-beginner-en-pwmb1/1/1 what you mean?


#12

Was sounding kind of whiny, there. Sorry about that.

Yes, the URL in the location bar of the lesson. It can be truncated...

https://www.codecademy.com/courses/python-beginner-en-pwmb1/1/1