猫史档案馆


【Python作品分享】TF2-01

用户:NT_wei玮NT_wei玮查看:0 回复:2 评论:0 创建时间:2021-06-19T11:58:51


【作品展示】

center_image

 

【作品介绍】

1235445

 

【作品源代码】

import turtle
import random
mypen = turtle.Pen()
mypen.bk(300)
length = 600
mypen.pensize(40)
mypen.pencolor("lightsalmon")
mypen.forward(length)
mypen.pensize(30)
mypen.pencolor("white")
mypen.backward(length)

total_num=0
while total_num<60:
    #玩家输入整数
    myscreen=turtle.Screen()

    player_num=int(myscreen.textinput("谁先达到30!","请输入1-5范围的整数"))
    print("刘某出的数:", player_num)
    mypen.pencolor("green")
    mypen.fd(player_num*10)
    total_num = total_num+player_num
    print("累计总和:", total_num)
    if total_num==60:
        print("刘某,你居然赢了老黄老师,可喜可贺可喜可贺!奖励你一个鸡腿")
    elif total_num>60:
        print("刘某,你居然败给了老黄老师,太惨了!")
    else:
        #电脑随机出整数
        com_num=random.randint(0,10)
        print("老黄老师出的数:",com_num)
        mypen.pencolor("salmon")
        mypen.fd(com_num*10)
        total_num = total_num+com_num
        print("累计总和:", total_num)
        if total_num==60:
            print("老黄老师,你居然赢了刘某,可喜可贺可喜可贺!")
        elif total_num > 60:
            print("老黄老师,你居然败给了刘某,太惨了!")
        else:
            print("-----------")

mypen.hideturtle()
turtle.done()

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
小苏打_小苏打_

不是

图片里用的是tkinter和requests

做了一个个人爬虫

 

源代码怎么就成了海龟绘图???

点赞0


评论


小苏打_小苏打_

有一个喵ug

只要我输入六十就行了

点赞0


评论