Перегони черепах повний код пж!Незнаю да помилка!

from turtle import *

from random import *


t = Turtle()

t.penup()

t.goto(-100, 100)

t.pendown()


t.speed(0)


for i in range(0, 15):

t.write(i)

t.right(90)

t.forward(200)


t.left(180)

t.forward(200)

t.right(90)


t.forward(20)


first=Turtle()

first.shape("turtle")

first.color("red")

first.penup()

first.goto(-120,70)

first.pendown()


second=Turtle()

second.shape("turtle")

second.color("blue")

second.penup()

second.goto(-120,35)

second.pendown()


third=Turtle()

third.shape("turtle")

third.color("yellow")

third.penup()

third.goto(-120,0)

third.pendown()


fourth=Turtle()

fourth.shape("turtle")

fourth.color("green")

fourth.penup()

fourth.goto(-120, -35)

fourth.pendown()


fifth = Turtle()

fifth.shape("turtle")

fifth.color("orange")

fifth.penup()

fifth.goto(-120, -70)

fifth.pendown()


chs = randint(1, 10)

sps = ["red", "blue", "yellow", "green", "orange"]


for i in range(0, chs + 1):

chs1 = randint(1, 5)

if chs1 == 1:

chs2 = "red"

elif chs1 == 2:

chs2 = "blue"

elif chs1 == 3:

chs2 = "yellow"

elif chs1 == 4:

chs2 = "green"

else:

chs2 = "orange"


bol = Turtle()

bol.shape("turtle")

bol.color(chs2)

bol.penup()

bol.goto(-90 + 25 * i, -120)

bol.pendown()

bol.left(90)


x_first = 0

x_second = 0

x_third = 0

x_fourth = 0

x_fifth = 0


text = input('Прогноз, какая черепаха победит?')

tex = Turtle()

tex.penup()

tex.goto(-120, 120)

tex.hideturtle()

tex.write('Ты считаешь, что победит ' + text, font = ('Arial', 12, 'bold'))



def move_turtle(num, turtle_):

step = randint(1, 5)

num += step

turtle_.up()

turtle_.forward(step)

return num


def place():

yield from ['Первое место', 'Второе место', 'Третье место']


def is_winner(num, string_num, winners, x):

if num >= 305 and winners.get(string_num) is None and winners['count'] < 3:

winners[string_num] = next(x)

winners['count'] += 1


x = place()


winners = {'count': 0}


while True:

x_first = move_turtle(x_first, first)

is_winner(x_first, '1 черепаха', winners, x)

x_second = move_turtle(x_second, second)

is_winner(x_second, '2 черепаха', winners, x)

x_third = move_turtle(x_third, third)

is_winner(x_third, '3 черепаха', winners, x)

x_fourth = move_turtle(x_fourth, fourth)

is_winner(x_fourth, '4 черепаха', winners, x)

x_fifth = move_turtle(x_fifth, fifth)

is_winner(x_fifth, '5 черепаха', winners, x)


if winners['count'] == 3:

break


del winners['count']

print(winners)

Ответы

Ответ дал: Fixsix
0

Ответ:

from turtle import *

from random import *

t = Turtle()

t.penup()

t.goto(-100,100)

t.pendown()

t.speed(0)

for i in range(0,15):

  t.write(i)

  t.right(90)

  t.forward(200)

  t.left(180)

  t.forward(200)

  t.right(90)

  t.forward(20)

  first=Turtle()

  first.shape("turtle")

  first.color("red")

  first.penup()

  first.goto(-120,70)

  first.pendown()

xx=-100

for i in range(10):

  z1=Turtle()

  z1.shape("turtle")

  z1.color("#800080")

  z1.penup()

  z1.goto(xx,-150)

  z1.left(90)

  z1.pendown()

  xx=xx+30

second=Turtle()

second.shape("turtle")

second.color("blue")

second.penup()

second.goto(-120,40)

second.pendown()

fr=Turtle()

fr.shape("turtle")

fr.color("yellow")

fr.penup()

fr.goto(-120,10)

fr.pendown()

x_first=0

x_second=0

x_fr=0

while x_first<305 and x_second<305 and x_fr<305:

  first_step = randint(1,5)

  x_first += first_step

  first.forward(first_step)

  second_step = randint(1,5)

  x_second += second_step

  second.forward(second_step)

  fr_step = randint(1,5)

  x_fr += second_step

  fr.forward(fr_step)

Объяснение:

Вас заинтересует