4/8 every time a new error now this. Please Help


#1

def rental_car_cost(d):
costperday = 40*d
if(d >= 3 and d <= 6):
return costperday -20
elif (d > 6):
return costperday - 50
else:
return costperday

File "python", line 19
SyntaxError: 'return' outside function

what does this error mean?


#2

if this is happening it mean you have an indentation issue going on. Make sure the return is inside the function
like tihis

def rental_car_cost(d):
    costperday = 40*d
    if(d >= 3 and d <= 6):
        return costperday -20
    elif (d > 6):
        return costperday - 50
    else:
        return costperday

#3

well its exactly like this


#4

can you post what you have so far here.
Now when you paste it here make sure you put 3 backquotes at the beginning and the end of the code


#5

Do you have some thing like this

def hotel_cost(nights):
	total = nights*140
	return total
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
	else:
		return 0
def rental_car_cost(d):
	costperday = d * 40
	if(d >= 3 and d <= 6):
		return costperday-20
	elif (d > 6):
		return costperday - 50
	else:
		returncostperday

#6

it worked now,thank you
the solution was your 1st answer