-
Notifications
You must be signed in to change notification settings - Fork 415
/
Copy pathturtle race.py
48 lines (40 loc) · 1.07 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
from turtle import Turtle
from random import randint
aman=Turtle()
aman.color('blue')
aman.shape('turtle')
aman.penup()
aman.goto(-180,100)
aman.pendown()
swati=Turtle()
swati.color('red')
swati.shape('turtle')
swati.penup()
swati.goto(-180,70)
swati.pendown()
ram=Turtle()
ram.color('green')
ram.shape('turtle')
ram.penup()
ram.goto(-180,40)
ram.pendown()
krishna=Turtle()
krishna.color('dark blue')
krishna.shape('turtle')
krishna.penup()
krishna.goto(-180,10)
krishna.pendown()
for movement in range(100):
aman.forward(randint(1,5))
swati.forward(randint(1, 5))
ram.forward(randint(1, 5))
krishna.forward(randint(1, 5))
if aman.position() > (swati.position() and ram.position()and krishna.position()):
print(("Aman won the race"))
elif swati.position()>(aman.position() and ram.position() and krishna.position()):
print("swati won the race")
elif ram.position()> (aman.position() and swati.position() and krishna.position()):
print("ram won the race")
else:
print("Krishna won the race")
input(" ...")