3.30

while True:
    try:
        num1 = int(input('the first num:'))
        num2 = int(input('the second num'))
        result = num1 / num2
    except Exception as err:
        print(err)
    else:
        break                   #用以跳出循环,灭有异常测跳出循环
    #finally:
       # f.close()
        
        #上下文管理器
        #with
def trans(n):
    if(n>=2):
        trans(n//2)
    print(n%2,end='')
    
p=trans(34)

#end = ''
#连续输出

你可能感兴趣的:(3.30)