Help number 7


#1

def costo_hotel(noches):
return 140 * noches

def costo_del_vuelo(ciudad):
cities = {
"Córdoba": 821,
"Iguazú": 941,
"Ushuaia": 1280,
"Bariloche": 1848,

return cities[ciudad]

def alquiler_de_auto(dias):
costo = dias * 338
if dias >= 7:
costo = costo - 100
elif dias >= 3:
costo = costo - 50
return costo

def costo_viaje(ciudad,dias,dinero_gastado):
return alquiler_de_auto(dias)+costo_hotel(dias)+costo_del_vuelo(ciudad)+dinero_gastado
print costo_viaje("Bariloche",5,600)


#2

This 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):
cost = days * 40
if days >= 7:
cost -= 50
elif days >=3:
cost -= 20
return cost

def trip_cost(city, days, spending_money):
return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city) + spending_money
print trip_cost("Los Angeles",5,600)


#3

Be carreful with your Indentation of Print , It can results by an error if you put print just below the function
But if you indent and return of the begin of line and put it , If your code it correct , It will work.

This is mine :wink:

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 40*days - 50
elif days >= 3:
return 40*days - 20
else :
return 40*days
def trip_cost(city, days, spending_money):
return rental_car_cost(days) + hotel_cost(days)
+ plane_ride_cost(city) + spending_money

print trip_cost("Tampa", 5, 600)