【发布时间】:2020-12-14 17:14:13
【问题描述】:
我打算尝试进行一场乌龟比赛,让你选择一个乌龟的名字,并尝试能够猜出将赢得比赛的乌龟到目前为止我遇到了一些问题,但现在我无法弄清楚是什么出错了,有人能告诉我为什么会出现这个错误代码吗? (我是堆栈溢出的新手)
import turtle
import random
from turtle import *
from random import randint
speed()
penup()
goto(-140, 140)
for i in range(15):
write(i,align = "center")
right(90)
for num in range(8):
penup()
forward(10)
pendown()
forward(10)
penup()
backward(160)
left(90)
forward(20)
A = turtle.Turtle()
A.shape('turtle')
A.color('red')
A.penup()
A.goto(-160, 100)
B = turtle.Turtle()
B.shape('turtle')
B.color('red')
B.penup()
B.goto(-160, 70)
C = turtle.Turtle()
C.shape('turtle')
C.color('red')
C.penup()
C.goto(-160, 40)
random.randint(1, 5)
random = random.randint(1, 7)
D = turtle.Turtle()
D.shape('turtle')
D.color('red')
D.penup()
D.goto(-160, 10)
for i in range(100):
A.forward(randint(1,5))
B.forward(randint(1,5))
C.forward(randint(1,5))
D.forward(randint(1,5))
if A.xcor > B.xcor and A.xcor > C.xcor and A.xcor > D.xcor:
print("Wow the turtle you picked you picked wow the race!")
【问题讨论】:
标签: python typeerror turtle-graphics python-turtle