Unsure why the check my answer says my code is producing a different result from the given solution

Codecademy is firing off " every_three_nums(91) should have returned [91, 94, 97, 100] , and it returned [91, 94, 97, 100, 91, 94, 97, 100]"

my code is only returning [91, 94, 97, 100] when ran.

Can someone help to see if this is a glitch on codecademy’s side or if I’m doing something incorrectly without realizing it? My code and attached picture is below.

new_list = []
def every_three_nums(start):
  for i in range(start, 101, 3):
    new_list.append(i)
  return new_list
#Uncomment the line below when your function is done
print(every_three_nums(91))

There is the issue. The list is not empty when the test is run since it has be populated by your own test results from line 8. In order for every test to conclude in expected fashion, the list should be zeroed out with each invocation. That means the list should be declared inside the function body.

2 Likes

Understood, thank you!

1 Like