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

【作品介绍】
官方发的六一儿童节门票下有一串字符,现已得出是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