猫史档案馆


【Python作品分享】气泡鱼语学家

用户:上进的阿米巴scdr上进的阿米巴scdr查看:2 回复:3 评论:2 创建时间:2020-05-30T20:25:23


【作品展示】

center_image

 

【作品介绍】

官方发的六一儿童节门票下有一串字符,现已得出是548934763617527这个15位数。

 

【作品源代码】

def translate(txt): # 数字翻译
    otp2 = ''
    # 初级数字化
    for s in txt:
        if s == 'O':
            otp2 += '2'
        elif s == 'o':
            otp2 += '1'
        elif s == '0':
            otp2 += '0'
    # 三进制(最终)
    times = 0
    otp = 0
    for i in otp2:
        otp += int(i)*(3**times)
        times += 1
    return otp


def a():
    # 主函数
    text = 'OooOOOOoOOooooo0OoOOooOoOOOOOoO'# 门票下的一串气泡,由O,o,0组成
    txt = translate(text)
    b = bin(int(txt))
    o = oct(int(txt))
    d = str(txt)
    h = hex(int(txt))
    b = b[3:]
    o = o[3:]
    h = h[3:]
    otp = {
        'bin': b,
        'oct': o,
        'dec': d,
        'hex': h,
    }
    return otp # 输出


if __name__ == '__main__':
    print(a())

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
竹林Anmitcius竹林Anmitcius

膜拜大佬!!!(不过仍然不知道这一串数字代表的是什么T^T)

点赞0


评论


蒟蒻OIer1048576蒟蒻OIer1048576

啊这,很简单的啊

点赞0


评论


传闻中的五音璃音传闻中的五音璃音

系统消息里的图片下面的不是什么数字哦

那个是说:你好

点赞0


评论