Drawing on python and pycharm
Question: I am a beginner on Python. I draw a square with this code.

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

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?

    
    
    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()
    


Answer: You need to call the function so it will start:

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

