draw circle in python

Below is an example code to draw a circle using the turtle graphics module in Python:

main.py
import turtle

# Creating turtle screen
t = turtle.Turtle()
screen = turtle.Screen()

# Drawing circle
t.circle(50)

# Exiting the screen on click
screen.exitonclick()
168 chars
12 lines

In the above code, we first import the turtle module and create a Turtle object. Then, we create a Screen object to display the turtle graphics.

Next, we use the circle() method of the Turtle object to draw a circle with a radius of 50 units. Finally, we use the exitonclick() method of the Screen object to keep the screen active until we click on it.

gistlibby LogSnag