To determine the binary representation of 41 we take the following steps:
Therefore,
xxxxxxxxxx
def binary_rep(n):
if n==0:
return '0'
else:
k=abs(n)
s=''
while k>0:
s=str(k%2)+s
k=k//2
if n < 0:
s='-'+s
return s
binary_rep(41)