猫史档案馆


【Python作品分享】我的文件【作品秀】

用户:tiansming游戏开创者tiansming游戏开创者查看:0 回复:1 评论:0 创建时间:2021-07-05T13:21:22


【作品展示】

center_image

 

【作品介绍】

哈哈哈

 

【作品源代码】


import random
import turtle
X = turtle.Turtle()
X.speed(0)
X.color("grey")
X.begin_fill()
X.goto(-150, 50)
for i in range(2):
   X.forward(300)
   X.right(90)
   X.forward(100)
   X.right(90)

X.end_fill()
X.forward(300)
X.color("red")
X.begin_fill()
X.forward(10)
X.right(90)
X.forward(100)
X.right(90)
X.forward(10)
X.end_fill()

X.penup()
X.goto(-150, 0)
X.color("white")
X.pendown()
X.right(180)
X.forward(310)
C = turtle.Turtle()
C.color("yellow")
C.shape("turtle")

C.penup()
C.goto(-140, 25)
C.write("黄")
C.pendown()
B = turtle.Turtle()
B.color("black")
B.shape("turtle")
B.penup()
B.goto(-140, -25)
B.write("黑")
B.pendown()
while (C.xcor() <= 130 or B.xcor() <= 130):
    C.penup()
    haigui1 = random.randint(1, 2)
    C.forward(haigui1)
    B.penup()
    haigui2 = random.randint(1, 2)
    B.forward(haigui2)


if C.xcor() <= 130:
    print("黄龟赢了")
else:
    print("黑龟赢了")
turtle.done()

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
Scp096之ICEScp096之ICE

秀一秀我的python

点赞0


评论