while for循环的套用,break,continue

while True:
    number=int(input('请输入一个数字:'))
    n=0
    akl=[]
    while number!=0:
        
        if number%2!=0:
            a=1
            akl.append(a)
            n+=1
            number=int(number/2)    
        else:
            b=0
            akl.append(b)
            n+=1
            number=int(number/2)
    ak=akl[::-1]
    end:print('二进制位:',end='')
    for i in ak:
        end:print(i, end='')    
        print('\n')
n=0
for a in range(1,6):
    for b in range(1,6):
        if b==a:
            continue
        else:
            for c in range(1,6):
                if c!=a and c!=b:
                    z=a*100+b*10+c
                    print(z)
                    n+=1                    
                    continue                
                else:
                    continue
            continue
print('一共%s种组合'%n)            


 
 

你可能感兴趣的:(python)