Drawing on python and pycharm
<p>I am a beginner on Python. I draw a square with this code.</p>

<pre><code>import turtle
square=turtle.Turtle()
print(square)
for i in range(4):
    square.fd(100)
    square.lt(90)
turtle.mainloop()
</code></pre>

<p>However, there is another code for drawing square with this code in the book. Apparently, I tried to copy the exact same thing but it didn't work out. Can someone help me to figure out the problem?</p>

<pre><code>def drawSquare(t,sz):
    """Make turtle t draw a square of sz."""

    for i in range(4):
        t.forward(sz)
        t.left(90)
    turtle.mainloop()
</code></pre>

<p>You need to call the function so it will start:</p>

<pre><code>import turtle

def drawSquare(t, size):
    for i in range(4):
        t.forward(size)
        t.left(90)
    turtle.mainloop()

drawSquare(turtle.Turtle(), 100)
</code></pre>

python turtle-graphics