Python turtle won't create multiple squares
<p>I tried to play around with this code many times but I can't create multiple squares. This is the problem:</p>

<p>Write a function named drawSquares that calls drawSquare to draw a
specified number of squares.
The function drawSquares takes four parameters: a turtle t, an integer size, an integer num, the number of squares to draw, and an integer angle, the clockwise rotation between successive squares</p>

<p>For example, the following would be
correct output.</p>

<p>import turtle</p>

<p>s = turtle.Screen()</p>

<p>snapper = turtle.Turtle()</p>

<p>drawSquares(snapper, 100, 4, 20)</p>

<pre><code>import turtle

s = turtle.Screen()
t = turtle.Turtle()

def drawSquares(t, size, num, angle):

for i in range(num):
    for x in range(num):
        t.forward(size)
        t.right(angle)

t.forward(size)

drawSquares(t, 100, 4, 20)
</code></pre>

<p>If I understand you correctly, this code should do exactly what you want:</p>

<pre><code>import turtle

s = turtle.Screen()
t = turtle.Turtle()

def drawSquares(t, size, num, angle):

    for i in range(num):
        for x in range(4):
            turtle.forward(size)
            turtle.left(90)
        turtle.right(angle)

drawSquares(t, 100, 4, 20)
</code></pre>

python turtle-graphics