您当前所在位置:
首页 方法技巧 查询大乐透号码或者索引值

查询大乐透号码或者索引值

北京风哥 56 2024-07-02 09:10
@shgu1981 老铁私信,希望实现超级大乐透前区红球绝对序号转换五红号码软件,以下是代码:

[code]import itertools
input_str=input('输入大乐透绝对值或者大乐透5个红球号码(号码格式:01 02 03 04 05)\n')
dlt_combin=list(itertools.combinations(['%02d'%x for x in range(1,36)],5))
if ' ' not in input_str:
index=int(input_str)-1
code=' '.join(dlt_combin)
print(f'绝对值 {input_str} 所对应的号码组合是:{code}')
else:
code=tuple(input_str.split(' '))
index=dlt_combin.index(code)+1
print(f'号码:{input_str} 所对应的绝对值={index}')