-
Notifications
You must be signed in to change notification settings - Fork 0
/
turtle_race.py
66 lines (52 loc) · 1.01 KB
/
turtle_race.py
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
54
55
56
57
58
59
60
61
62
63
64
65
66
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 12 04:26:17 2018
Project ::: turtle race
@author: aryman
"""
from turtle import * #turtle is module
from random import randint #genrate randome number
write("Turtle Race", align='left')
speed(30)
penup()
goto(-140, 140)
for step in range(7):
write(step, align='center')
right(90)
forward(10)
pendown()
forward(150)
penup()
backward(160)
left(90)
forward(20)
a = Turtle()
a.color('red')
a.shape('turtle')
a.penup()
a.goto(-160, 100)
a.pendown()
b = Turtle()
b.color('blue')
b.shape('turtle')
b.penup()
b.goto(-160, 80)
b.pendown()
c = Turtle()
c.color('yellow')
c.shape('turtle')
c.penup()
c.goto(-160, 60)
c.pendown()
d = Turtle()
d.color('green')
d.shape('turtle')
d.penup()
d.goto(-160, 40)
d.pendown()
for turn in range(50):
a.forward(randint(1, 5))
b.forward(randint(1, 5))
c.forward(randint(1, 5))
d.forward(randint(1, 5))
exit = input("Enter to exit!!!")