Untitled

 avatar
unknown
plain_text
10 months ago
1.4 kB
18
Indexable
import turtle
import random

t = turtle.Turtle()
t.up()
t.goto(-100,100)
t.down()
t.speed(0)

# campo de carrera
for i in range(15):
    t.write(i)
    t.rt(90)
    t.fd(140)
    t.bk(140)
    t.lt(90)
    t.fd(20)

#Creando las tortugas
first = turtle.Turtle()
first.color('cyan')
first.shape('turtle')
first.up()
first.goto(-120,80)
first.down()

second = turtle.Turtle()
second.color('tomato')
second.shape('turtle')
second.up()
second.goto(-120,50)
second.down()

third = turtle.Turtle()
third.color('gold')
third.shape('turtle')
third.up()
third.goto(-120,20)
third.down()

fanaticos = random.randint(1,10)
for i in range(fanaticos):
    fan = turtle.Turtle()
    fan.color('purple')
    fan.shape('turtle')
    fan.up()
    fan.goto(-90+(25*i),-50)
    fan.lt(90)

win = input ("Cuál tortuga ganará:")
text = turtle.Turtle()
text.up()
text.goto(-120,120)
text.write("Piensas que la ganadora será " + win)

x_first = 0
x_second = 0
x_third = 0

while True:
    if x_first>=305 or x_second>=305 or x_third>=305:
        break

    pasos1 = random.randint(1,5)
    first.fd(pasos1)
    x_first = x_first + pasos1

    pasos2 = random.randint(1,5)
    second.fd(pasos2)
    x_second = x_second + pasos2

    pasos3 = random.randint(1,5)
    third.fd(pasos3)
    x_third = x_third + pasos3
Editor is loading...
Leave a Comment