# get integer version of binary number
int(bin(8)[2:])
>>> bin(88)
'0b1011000'
>>> int('0b1011000', 2)
88
>>>
>>> a=int('01100000', 2)
>>> b=int('00100110', 2)
>>> bin(a & b)
'0b100000'
>>> bin(a | b)
'0b1100110'
>>> bin(a ^ b)
'0b1000110'
num = int(input("Enter a number: ")) #generates a number
print(int(bin(num[2:]))) #converts the number to binary and prints it
#the [2:] is there because there is a b showing it is bnary but we dont want that in a binary number
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