generated from mwc/lab_turtle
created for loops to create circles at each point
of the initial star. i was initally just going to draw a bunch of different circles but then I wanted to see how I can create a repetitive pattern with for loops. I had fun and saw it as a puzzle that needed to be solved through trial and errors.
This commit is contained in:
56
drawing.py
56
drawing.py
@@ -6,17 +6,73 @@ from turtle import (
|
|||||||
penup,
|
penup,
|
||||||
pendown,
|
pendown,
|
||||||
color,
|
color,
|
||||||
|
circle,
|
||||||
|
shape
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
lst=["purple","gold","green","blue","teal"]
|
||||||
|
for x in range(20,100,25):
|
||||||
|
color(lst[x%4])
|
||||||
|
penup()
|
||||||
forward(100)
|
forward(100)
|
||||||
right(360 * 2 / 5)
|
right(360 * 2 / 5)
|
||||||
|
pendown()
|
||||||
|
circle(x)
|
||||||
|
penup()
|
||||||
forward(100)
|
forward(100)
|
||||||
right(360 * 2 / 5)
|
right(360 * 2 / 5)
|
||||||
|
pendown()
|
||||||
|
circle(x)
|
||||||
|
penup()
|
||||||
forward(100)
|
forward(100)
|
||||||
right(360 * 2 / 5)
|
right(360 * 2 / 5)
|
||||||
|
pendown()
|
||||||
|
circle(x)
|
||||||
|
penup()
|
||||||
forward(100)
|
forward(100)
|
||||||
right(360 * 2 / 5)
|
right(360 * 2 / 5)
|
||||||
|
pendown()
|
||||||
|
circle(x)
|
||||||
|
penup()
|
||||||
forward(100)
|
forward(100)
|
||||||
right(360 * 2 / 5)
|
right(360 * 2 / 5)
|
||||||
|
pendown()
|
||||||
|
circle(x)
|
||||||
|
|
||||||
|
for m in range(4):
|
||||||
|
penup()
|
||||||
|
left(90)
|
||||||
|
forward(50)
|
||||||
|
pendown()
|
||||||
|
|
||||||
|
for x in range(20,100,25):
|
||||||
|
color(lst[x%4])
|
||||||
|
penup()
|
||||||
|
forward(100)
|
||||||
|
right(360 * 2 / 5)
|
||||||
|
pendown()
|
||||||
|
circle(x)
|
||||||
|
penup()
|
||||||
|
forward(100)
|
||||||
|
right(360 * 2 / 5)
|
||||||
|
pendown()
|
||||||
|
circle(x)
|
||||||
|
penup()
|
||||||
|
forward(100)
|
||||||
|
right(360 * 2 / 5)
|
||||||
|
pendown()
|
||||||
|
circle(x)
|
||||||
|
penup()
|
||||||
|
forward(100)
|
||||||
|
right(360 * 2 / 5)
|
||||||
|
pendown()
|
||||||
|
circle(x)
|
||||||
|
penup()
|
||||||
|
forward(100)
|
||||||
|
right(360 * 2 / 5)
|
||||||
|
pendown()
|
||||||
|
circle(x)
|
||||||
|
|
||||||
|
|
||||||
input()
|
input()
|
||||||
Reference in New Issue
Block a user