reverse(100) is not valid Python syntax here. this would be right: for i in range(100, -1, -1): also, j is not needed here.