Need Help On Transportation


#1



Hi I tried number of times and I keep getting the same thing
Oops, try again. Your code looks a bit off. Feel free to peek back at earlier exercises if you need a refresher! Your code threw the following error: unexpected indent (python, line 14)
Could you please help out!

:confounded::confounded:

https://www.codecademy.com/courses/python-beginner-P5YtY/1/3?curriculum_id=4f89dab3d788890003000096#


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


#2

this should be the correct format, even if i myself have a little error atm.


hope i helped :slight_smile:

edit: just delete line 19 ^^


#3

What looks to be the problem is your line that has
def rental_car_cost(days): total=days*40

That "total=days*40 should be on the next line and indented.


#4

Just add 4 spaces or a Tab before this line (elif days>=3 and days<7:)..
ur error was caused by the indentation error u have to place 'elif' just below the 'if', otherwise if .... elif...else will not work


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.