python 试题第二题代码,请高人指点(原来可以算出结果直接打出来啊啊啊啊!)

t330034013 2023-10-15 18:46:51 2023-10-17 10:25:15

nums = 0

for i in range(12345678, 98765433):
    
    sent = str(i)
    words =list(c for c in sent)
    
    
    ban = ['4', '3', '9', '6']
    ord = 0
    for j in words:
        if ord == 4:
            break
        if j != ban[ord]:
            continue
        elif j == ban[ord]:
            ord += 1
    if ord < 4:
        nums += 1
print(nums)