Skip to content

Commit 121076a

Browse files
authored
Update and rename task5.py to colored_line.py
1 parent 7a70467 commit 121076a

File tree

2 files changed

+20
-17
lines changed

2 files changed

+20
-17
lines changed

colored_line.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import turtle
2+
from turtle import Screen
3+
import random
4+
5+
#going forward at a 90 degree angle, either clockwise or anticlockwise, or going straight
6+
#each time with a random color selected from a list
7+
#to draw a colorful geometric looking pattern
8+
screen= Screen()
9+
speed=30
10+
angle = [90,180,270]
11+
colors = ["blue", "red", "pink", "purple", "yellow", "cyan", "light blue", "brown", "light green" ]
12+
line = turtle.Turtle()
13+
line.hideturtle()
14+
line.width(width=5)
15+
for i in range (0,50):
16+
line.forward(speed)
17+
line.setheading(random.choice(angle))
18+
line.color(random.choice(colors))
19+
20+
turtle.done()

task5.py

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)