20190309

#################PYTHON########################

##Digital Convert

def mains(Num,unitNum):
    global countNum
    global flagNum
    while flagNum:
        if 0<Num<unitNum:
            numList.append(Num)
            flagNum = False
        elif Num == 0:
            flagNum = False
            break
        else:
            resNum = Num - unitNum
            countNum += 1
            if resNum >= unitNum:
                Num = resNum
                continue
            elif resNum == 0:
                Num = countNum
                countNum = 0
                numList.append(resNum)
                continue
            else:
                numList.append(resNum)
                Num = countNum
                countNum = 0
                continue
    return numList

#Nun is inputed digital

#unitNum is the end-on system what you want to have convert

posted @ 2019-03-09 23:11  pie_thn  阅读(93)  评论(0编辑  收藏  举报