Calcul d'un coût total en Python

Je suis en train de créer un carnet de voyage en python, mais après avoir défini toutes les fonctions, je ne suis pas en mesure de les appeler et de les calculer dans la dernière fonction tripCost().

Dans tripCost, je veux mettre en les jours et de destination (ville) et le programme exécute les fonctions et les me donne le résultat exact de tous les 3 fonctions définies précédemment.

Code:

def hotelCost(): 
    days = raw_input ("How many nights will you stay at the hotel?")
    total = 140 * int(days) print "The total cost is",total,"dollars"


def planeRideCost(): 
    city = raw_input ("Wich city will you travel to\n")
    if city == 'Charlotte':
        return "The cost is 183$"
    elif city == 'Tampa':
        return "The cost is 220$"
    elif city == 'Pittsburgh':
        return "The cost is 222$"
    elif city == 'Los Angeles':
        return "The cost is 475$"
    else:
        return "That's not a valid destination"

def rentalCarCost(): 
    rental_days = raw_input ("How many days will you rent the car\n")   
    discount_3 = 40 * int(rental_days) * 0.2 
    discount_7 = 40 * int(rental_days) * 0.5 
    total_rent3 = 40 * int(rental_days) - discount_3
    total_rent7 = 40 * int(rental_days) - discount_7
    cost_day = 40 * int(rental_days) 

    if int(rental_days) >= 3: 
        print "The total cost is", total_rent3, "dollars"
    elif int(rental_days) >= 7: 
        print "The total cost is", total_rent7, "dollars"
    else: 
        print "The total cost is", cost_day, "dollars"

def tripCost():
    travel_city = raw_input ("What's our destination\n")
    days_travel = raw_input ("\nHow many days will you stay\n")
    total_trip_cost = hotelCost(int(day_travel)) + planeRideCost (str(travel_city)) + rentalCost (int(days_travel))
    return "The total cost with the trip is", total_trip_cost

tripCost()
  • Veuillez indenter ton code correctement.