def bin(n): s="" while n!=0: if n%2==1: s+="1" n//=2 elif n%2==0: s+='0' n//=2 return s
num = 10 bin(num)