What's wrong with my code?


I have a problem with an exercice :


It says me that : Be sure that voyage_cout take exactly three settings : ville, jours, and depense_argent (in this order).

def hotel_cout(ville):
    return 140*nuits
def avion_billet_cout(ville):
    if ville == "Charlotte":
        return 183
    elif ville == "Tampa":
        return 220
    elif ville == "Pittsburgh":
        return 222
    elif ville == "Los Angeles":
        return 475
def location_voiture_cout(jours):
    if jours >=7:
        return (40*jours)-50
    elif jours >=3:
        return (40*jours)-20
        return 40*jours
def voyage_cout(ville, jours, depense_argent):
    return ville + jours + depense_argent

I search but I can't find my error :confused:

And sorry if my english isn't correct !


The error message does not reflect what's wrong with your code. You're actually getting a TypeError when voyage_cout is called, because you're appending numbers (jours and depense_argent) to a string ville. You first have to convert both the numbers to strings (using the str function).


Oh okaay, tanks for your fast answer :smiley: