Correct output but it's showing error

This is the question
** **Crte a function called every_three_nums that has one parameter named start .

The function should return a list of every third number between start and 100 (inclusive). For example, every_three_nums(91) should return the list [91, 94, 97, 100] . If start is greater than 100 , the function should return an empty list.**

This is my solution

def every_three_nums(start):
  if start < 100:
    lst = list(range(start, 101, 3))
    return lst
    lst = []
    return lst


While this produces the correct answer I’m getting a error

every_three_nums(100) should have returned [100] , and it returned

Can you guys help? what’s wrong here?

Consider step by step, line by line, what happens in your function if start = 100

You can briefly try your code outside a function if you like ,which should help you pick up on the minor error.

1 Like