while x:
第一次x=10
while 10:#为真
y = 10%2 #y=0
x = 10//2 #x=5
list.append(y) #list=[0]
第二次
while 5: #为真
y = 5%2 #y=1
x = 5//2 #x=2
list.append(y) #list=[0,1]
第三次
while 2: #为真
y = 2%2 #y=0
x = 2//2 #x=1
list.append(y) #list=[0,1,0]
第四次
while 1: #为真
y = 1%2 #y=1
x = 1//2 #x=0
list.append(y) #list=[0,1,0,1]
第五次
while 0: #为假while 中断
list=[0,1,0,1]
while list:
第一次:
while [0,1,0,1]: #为真
number += str(list.pop()) #number = '1' list = [0,1,0]
第二次
while [0,1,0]: #为真
number += str(list.pop()) #number = '10' list = [0,1]
第三次
while [0,1]: #为真
number += str(list.pop()) #number = '101' list = [0]
第四次
while [0]: #为真
number += str(list.pop()) #number = '1010' list = []
第五次
while []: #为假,中断
返回number #number = '1010'