The error appears on the last line of the code segment below, and i'm not sure why. I'm attempting to learn from a video i found online, which has the same code, even when i've checked multiple times and seems to work fine.

```
class Snake:
    def __init__(self):
        self.position=[50,50]
        self.body=[[100,50], [90.50], [80,50]]
        self.direction = "RIGHT"
        self.changeDirectionTo=self.direction

    def getBody(self):
        return self.body

window=pygame.display.set_mode((500,500))
snake = Snake()

while True:
    for pos in snake.getBody():
        pygame.draw.rect(window, pygame.Color(0,225,0),
                         pygame.Rect(pos[0], pos[1], 10,10))

```