猫史档案馆


【Python作品分享】喵号码机【作品秀】

用户:Sans~~~wJaWSans~~~wJaW查看:1 回复:2 评论:1 创建时间:2022-08-03T21:15:47


【作品展示】

center_image

 

【作品介绍】

重发

 

【作品源代码】

import random


money = 0
print("You must make 2 money to use the machine")
print("Here some question(two question to make one money).")
aa = int(input("56*32=?"))
if aa == 1792:
    money = (money + 0.5)
    print("Right,""money:",money)
else:
    print("Wrong,""money:",money)
bb = int(input("74*193=?"))
if bb == 14282:
    money = (money + 0.5)
    print("Right,""money:", money)
else:
    print("Wrong,""money:", money)
cc = int(input("236*8=?"))
if cc == 1888:
    money = (money + 0.5)
    print("Right,""money:", money)
else:
    print("Wrong,""money:", money)
dd = int(input("73+32*6-12=?"))
if dd == 253:
    money = (money + 0.5)
    print("Right,""money:", money)
else:
    print("Wrong,""money:", money)
ee = int(input("477/53+65=?"))
if ee == 74:
    money = (money + 0.5)
    print("Right,""money:", money)
else:
    print("Wrong,""money:", money)
ff = int(input("[(455-21)*6]/8+0.5=?"))
if ff == 326:
    money = (money + 0.5)
    print("Right,""money:", money)
else:
    print("Wrong,""money:", money)
if int(money) >= 2:
    print("Your money is enough,Please choose your number")
    a = int(input('choose a number(1-42)'))
    b = int(input('choose a number(1-42)'))
    c = int(input('choose a number(1-42)'))
    d = int(input('choose a number(1-42)'))
    e = int(input('choose a number(1-42)'))
    f = int(input('choose a number(1-42)'))
    g = random.randint(1, 42)
    h = random.randint(1, 42)
    i = random.randint(1, 42)
    j = random.randint(1, 42)
    k = random.randint(1, 42)
    l = random.randint(1, 42)
    print(g)
    print(h)
    print(i)
    print(j)
    print(k)
    print(l)
    q = 0
    if (a == g):
        q = (q + 1)
    if (b == h):
        q = (q + 1)
    if (c == i):
        q = (q + 1)
    if (d == j):
        q = (q + 1)
    if (e == k):
        q = (q + 1)
    if (f == l):
        q = (q + 1)
    print('你猜中了', q, '个')
else:
    print("Sorry,your money isn't enough,please come next time!")

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
刘骏森刘骏森

我觉得可以简化一下......

点赞0


评论


刘骏森刘骏森

print(g,'\n',h,'\n',i,'\n',j,'\n',k,'\n',l)

点赞0


评论