4. vacation


@stetim, i dont want to create new thread for the same topic. So replying to ur message

def hotel_cost (nights):
    return 140*nights
    c = 183
    t = 220
    p = 222
    m = 475
def plane_ride_cost (city):      
    if city == "Charlotte":
        return c
    if city == "Tampa":
        return t
    if city == "Los Angeles":
        return m
    if city == "Pittsburgh":
        return p
    else :
        return "Not a valid destination."

With above code i am getting the following caution notice "Oops, try again. Did you create a function called plane_ride_cost?"

BUT if i replace m (under los angeles) with "475" no caution message shows up. I used the same code as typed above in another compiler no cauion msgs showed up. So i am confused on this.

4. Vacation

no, you should create a new thread otherwise threads become a cluttered mess, there is a reason so many topics are closed, so people create new ones

its because you defined/declared c, t, p and m in hotel_cost function, this has two problems:

hotel_cost is never called so the function never executes

even if you call the function, c, t, p and m would have a local variable scope, so would still not work

why not place:

    c = 183
    t = 220
    p = 222
    m = 475

inside plane_ride_cost function? Design wise, that makes much more sense


sure i will create new thread next time. Thanks a lot for your time

and your advice worked. Thanks again