please code in python Here's an example created by rotating a square 9 times: Write a Python program that will produce our simplified "spirograph" images from squares. Your program should include a function: spiro(num, side) that takes two arguments: the number of squares to draw in one revolution, and the side length of each square in the figure. Remember: there are 360 degrees in a circle. Here is a function that demonstrates how to draw a randomly colored filled square. You’ll want to copy-paste this function into your program, and call this function from within a loop in your spirograph function, so that it draws multiple squares: import turtle, random turtle.speed(0) turtle.delay(0) def filled_square(side): r = random.random() g = random.random() b = random.random() turtle.color(r,g,b) turtle.begin_fill() for i in range(4): turtle.forward(side) turtle.left(90) turtle.end_fill()
please code in python
Here's an example created by rotating a square 9 times:
Write a Python program that will produce our simplified "spirograph" images from squares. Your program should include a function: spiro(num, side) that takes two arguments: the number of squares to draw in one revolution, and the side length of each square in the figure. Remember: there are 360 degrees in a circle.
Here is a function that demonstrates how to draw a randomly colored filled square. You’ll want to copy-paste this function into your program, and call this function from within a loop in your spirograph function, so that it draws multiple squares:
import turtle, random
turtle.speed(0)
turtle.delay(0)
def filled_square(side):
r = random.random()
g = random.random()
b = random.random()
turtle.color(r,g,b)
turtle.begin_fill()
for i in range(4):
turtle.forward(side)
turtle.left(90)
turtle.end_fill()
![Python Turtie Graphics](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Feb1193c9-d0d1-416d-ac45-bceed8a4dd09%2F8bbf8f5e-c470-4f52-bc17-8a547755990c%2F66b46_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Systems Architecture](https://www.bartleby.com/isbn_cover_images/9781305080195/9781305080195_smallCoverImage.gif)
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
![Fundamentals of Information Systems](https://www.bartleby.com/isbn_cover_images/9781337097536/9781337097536_smallCoverImage.gif)
![Systems Architecture](https://www.bartleby.com/isbn_cover_images/9781305080195/9781305080195_smallCoverImage.gif)
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
![Fundamentals of Information Systems](https://www.bartleby.com/isbn_cover_images/9781337097536/9781337097536_smallCoverImage.gif)
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781305480537/9781305480537_smallCoverImage.jpg)
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)