4/7 Taking vacatio

def rental_car_cost(days):
    if(days >= 7):
      return (days * 40) - 50
    elif(3 <= days < 7):
      return (days * 40) - 20
      return days * 40

When I run my code through the interpreter it asks if I created a rental_car_cost functions. I’m confused because I clearly did.


Hi @mooreo3,

Make sure that the header of the rental_car_cost function is not indented in your submission. If that is not the problem, please post the entirety of your code, so that we can see if there is another reason why your rental_car_cost function is not recognized.


I first coded mine the same way as you did. I’m sure our solution works, but probably isn’t what the lesson is asking for…

Looking at the sample code with score and tickets:

the variable tickets was defined to take the argument and multiply by ten.
Then during the if statements, it modifies/changes said variable which doesn’t require a return

Give the sample a good look again

def finish_game(score):
#MG - defines tickets and multiplies by argument taken from score
  tickets = 10 * score
  if score >= 10:
#MG - changes the variable for tickets
    tickets += 50
  elif score >= 7:
    tickets += 20
  return tickets

edit: 1 remove duplicate code


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