Decimal to binary

stk=[]
def push(ele):
    stk.append(ele)
def bin(t):
    if t==1:
        return push(1)
    return push(t%2),bin(t//2)
no=int(input("Enter the number: "))
bin(no)
stk=stk[::-1]
for i in stk:
    print(i,end='')

Comments