Elif Sytax Error Python

Nessi Source

I'm new to coding and got an error I don't know how to fix it. It is from codecademy lesson 4.

 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


File "python", line 17
        elif days >= 3
           ^
    SyntaxError: invalid syntax

if someone knows what is wrong could you please help.

python

Answers

You forgot a :

Change elif days >= 3 to elif days >= 3:

And unindent the line

answered 6 months ago Jon Reinhold #2

if days >= 7:
      cost -= 50
elif days >= 3:
      cost -= 20

Might want to read this: https://docs.python.org/3/tutorial/controlflow.html

comments powered by Disqus