I'm reading a book called "Math Adventures With Python" where it teaches you cool math experiments through the turtle module. The book offers a challenge where you are to make a spiral out of squares where the squares get larger every time. [It's supposed to look like this](https://i.stack.imgur.com/mnG2Q.jpg) I've been trying to increase the size of each side with an increasing variable inside a for loop but I get this error: **local variable 'x' referenced before assignment**

I have tried adding the variable inside a different loop and creating the variable inside the function.

```
from turtle import *

x = 100

def square():
    for i in range(4):
        right(90)
        forward(x)
        x += 5

for m in range(100):
    square()
    right(6)

```