Print a Spirograph using turtle in Python
Last Updated :
11 Sep, 2021
Pre-requisites: Turtle Programming in Python
A spirograph is a very interesting geometrical figure which is often symmetrical to both the axes. It produces mathematical roulette curves of the variety technically known as hypotrochoids and epitrochoids. Here, we’ve used a range of colors to draw circles, you can use your combination as per your color choice.
Below is the implementation.
Python3
import turtle as tt
tt.bgcolor( 'black' )
tt.pensize( 2 )
tt.speed( 10 )
for i in range ( 6 ):
for color in ( 'red' , 'magenta' , 'blue' ,
'cyan' , 'green' , 'white' ,
'yellow' ):
tt.color(color)
tt.circle( 100 )
tt.left( 10 )
tt.hideturtle()
|
Output:
Share your thoughts in the comments
Please Login to comment...