Python Turtle Codes

To draw a square

import turtle
t=turtle.Turtle()
for i in range(4):
    t.forward(200)
    t.right(90)

To draw a circle

import turtle
t=turtle.Turtle()
for i in range(360):
    t.forward(1)
    t.right(1)

To draw a rectangle

import turtle
t=turtle.Turtle()
for i in range(3):
    t.forward(200)
    t.right(90)
    t.forward(80)
    t.right(90)

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top