猫史档案馆


【Python作品分享】喵

用户:轩轩168轩轩168查看:0 回复:2 评论:0 创建时间:2021-08-15T19:47:11


【作品展示】

center_image

 

【作品介绍】

 

【作品源代码】

import random
while True:
    input("按下enter生成")
    a = input("地址码:")
    e = [1,3,5,7,8,10,12]
    f = [4,6,9,11]
    j = [7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2]
    b = random.randint(1990,2020)
    c = random.randint(1,12)
    if b % 4 == 0 and b % 100 != 0 or b % 400 == 0:
        if c in e:
            d = random.randint(1,31)
        elif c in f:
            d = random.randint(1,30)
        else:
            d = random.randint(1,29)
    else:
        if c in e:
            d = random.randint(1,31)
        elif c in f:
            d = random.randint(1,30)
        else:
            d = random.randint(1,28)
    if len(str(c)) == 1:
        c = "0" + str(c)
    if len(str(d)) == 1:
        d = "0" + str(d)
    year = str(b) + str(c) + str(d)
    sunxu = str(random.randint(0,1)) + str(random.randint(0,1))
    xingbie = random.randint(0,9) 
    zhanshi = str(a) + str(year) + str(sunxu) + str(xingbie)
    zhanshi = list(zhanshi)
    h = 0
    jisuan = []
    while h != 17:
        jisuan.append(int(zhanshi[h]) * int(j[h]))
        h += 1
    h = 0    
    i = 0
    while h != 17:
        i += int(jisuan[h])
        h += 1
    i = i % 11
    shenfenzheng = str(a) + str(year) + str(sunxu) + str(xingbie)
    if i == 0:
        shenfenzheng = str(shenfenzheng) + "1"
    elif i == 1:
        shenfenzheng = str(shenfenzheng) + "0"
    elif i == 2:
        shenfenzheng = str(shenfenzheng) + "x"
    elif i == 3:
        shenfenzheng = str(shenfenzheng) + "9"
    elif i == 4:
        shenfenzheng = str(shenfenzheng) + "8"
    elif i == 5:
        shenfenzheng = str(shenfenzheng) + "7"
    elif i == 6:
        shenfenzheng = str(shenfenzheng) + "6"
    elif i == 7:
        shenfenzheng = str(shenfenzheng) + "5"
    elif i == 8:
        shenfenzheng = str(shenfenzheng) + "4"
    elif i == 9:
        shenfenzheng = str(shenfenzheng) + "3"
    elif i == 10:
        shenfenzheng = str(shenfenzheng) + "2"
    print(shenfenzheng)

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
轩轩168轩轩168

更新了

https://shequ.codemao.cn/community/393011

点赞0


评论


轩轩168轩轩168

又更新了

https://shequ.codemao.cn/community/393014

点赞0


评论