#coding = <utf-8> import random from easygui import * msgbox("嗨,来玩个游戏吧,看看你脑子计算速度够不够快") a=random.randint(0,10) #print(a) msgbox("任意想一个0—10之间的数") x=random.randint(2,10) if x%2==0: y=x else: while(x%2): x=random.randint(2,10) y=x b=a*y #print(b) msgbox("把这个数乘以%d"%y) c=random.randint(10,50) if (b+c)%y==0: d=c else: while((b+c)%y): c=random.randint(10,50) d=c e=b+d #print(e) msgbox("再加上%d"%d) f=e/y #print(f) msgbox("再除以%d"%x) g=random.randint(10,100) if g%2==0: h=g else: while(g%2): g=random.randint(10,100) h=g i=f+h #print(i) msgbox("再加上%d"%h) j=i-a #print(j) msgbox("再减去刚才想的那个数") msgbox('我猜这个数是%d'%j)
需要安装一下easygui插件才能运行。