Help me i give up plz just give me the answer


#1

def hotel_cost(nights):
    costpernight = 140 # not used, remove this
    return 140*nights

def plane_ride_cost(city):
    if city == "Charlotte":
        return 183
    elif city == "Tampa":
        return 220
    elif city == "Pittsburgh":
        return 222
    elif city == "Los Angeles":
        return 475

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

def trip_cost(city,days,spending_money):
    return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city) 
    total_trip_cost = trip_cost("Tampa",3,1000) + 1000

#2

ignore the #text plz


#3

never mind I got the answer off a different site


#4

here is the correct code
def hotel_cost(nights):
return 140 * nights
def plane_ride_cost(city):
if city == "Charlotte":
return 183
elif city == "Tampa":
return 220
elif city == "Pittsburgh":
return 222
elif city == "Los Angeles":
return 475

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

def trip_cost(city, days, spending_money):
return plane_ride_cost(city) + rental_car_cost(days) + hotel_cost(days) + spending_money


#5

you might have to indent


#6

This...

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

May be simplified and rewritten as,

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

Be sure to follow the last instruction, which I believe specifies spending_money as 600.

print trip_cost("Tampa", 3, 600)    # no indentation on this line

#7

thx I used both codes and both were good


#8

wow I have been stuck on this forever, it never mentioned an indent problem for the print trip_cost at all. That was my issue! Thank you.