|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- 1.ef Dec2Bin(dec):
- 2.    temp = []
- 3.    result = ''
- 4.    
- 5.    while dec:
- 6.        quo = dec % 2
- 7.        dec = dec // 2
- 8.        temp.append(quo)
- 9.
- 10.    while temp:
- 11.        result += str(temp.pop())
- 12.    
- 13.    return result
- 14.
- 15.print(Dec2Bin(62))
复制代码
- def bin1(x):
- temp = []
- while x:
- y = x % 2
- x = x // 2
- temp.append(y)
- temp.reverse()
- return temp
复制代码
|
|