-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathturtle_run.py
More file actions
30 lines (27 loc) · 763 Bytes
/
turtle_run.py
File metadata and controls
30 lines (27 loc) · 763 Bytes
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
from turtle import Turtle, Screen
import random
screen = Screen()
screen.setup(width=800,height=200)
screen.bgcolor('black')
screen.textinput(title='Choose your turtle',prompt='Which turtle you believe will win?')
colors = ['red','orange','yellow','green','blue','purple',]
tartarugas = []
for i in colors:
quem = Turtle(shape='turtle')
quem.color(i)
quem.penup()
tartarugas.append(quem)
inicio = 60
for i in tartarugas:
i.goto(-380,inicio)
inicio -= 20
vencedora = 'branca'
winner = False
while winner == False:
for i in tartarugas:
i.forward(random.randint(1,15))
#vencedora = i.get
posicao = i.pos()
if posicao[0] >= 370:
winner = True
screen.exitonclick()