猫史档案馆


【Python作品分享】新的作品

用户:靐靐靐靐靐靐靐靐靐靐查看:0 回复:0 评论:0 创建时间:2023-04-08T11:20:32


【作品展示】

center_image

 

【作品介绍】

复刻《最强大脑》第10季《闪电心算》

 

【作品源代码】

import easygui
import random
import turtle
import time

__Pen = turtle.Pen()


a = 0
t = 0
if easygui.ynbox('难度?', None, ('啥也不是', '自定义')):
    for __count in range(10):
        a = random.randint(100, 999)
        np = (random.random())
        if (np <= 0.5):
            a = (0-a)
        t += a
        while True:
            __Pen.write(a, font = ('Arial', 30, 'italic'))
            time.sleep(0.5)
            break
        __Pen.clear()
    if (turtle.numinput(None, '请输入数字') == t):
        print('win!',t)
    else:
        print('try again!', t)
else:
    v1 = int(turtle.numinput('', '几位数?'))
    v2 = float(turtle.numinput('','间隔几秒?'))
    for __count in range(int(turtle.numinput('','几项?'))):
        a = random.randint(10**(v1-1),((10**v1)-1))
        np = random.random()
        if (np <= 0.5):
            a = 0-a
        t += a
        while True:
            __Pen.write(a,font=('Arial',30,'italic'))
            time.sleep(v2)
            break
        __Pen.clear()
    if (turtle.numinput(None,'please input number') == t):
        print('wow!',t)
    else:
        print("keep try!",t)



 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页