-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTurtleGraphics.py
More file actions
53 lines (47 loc) · 1.14 KB
/
TurtleGraphics.py
File metadata and controls
53 lines (47 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
################################
# Author: Rahim Siddiq
# Turtle Graphics Exercises
################################
import turtle
wn = turtle.Screen()
rahim = turtle.Turtle()
siddiq = turtle.Turtle()
### Problem 1 ###
for aColor in ["yellow", "red", "purple", "blue"]:
rahim.color(aColor)
rahim.forward(50)
rahim.left(90)
siddiq.back(50)
siddiq.right(90)
### Problem 2 ###
for aColor in ["yellow", "red", "purple", "blue"]:
rahim.color(aColor)
rahim.forward(50)
rahim.right(90)
siddiq.back(50)
siddiq.right(90)
### Problem 3 ###
for i in range(15):
for aColor in ["yellow", "red", "purple", "blue"]:
rahim.color(aColor)
rahim.forward(100)
rahim.left(90)
rahim.penup()
rahim.forward(25)
rahim.right(90)
rahim.forward(25)
rahim.left(120)
rahim.pendown()
### Problem 4 ###
for aColor in ["yellow", "red", "purple", "blue"]:
for i in range(3):
rahim.color(aColor)
rahim.forward(100)
rahim.left(120)
rahim.penup()
rahim.forward(20)
rahim.right(90)
rahim.forward(20)
rahim.left(120)
rahim.pendown()
wn.exitonclick()