Homework
Below is an example of decimal number to binary converter which you can use as a starting template.
# strs = ""
# while num:
# # if (num & 1) = 1
# if (num & 1):
# strs += "1"
# if (num & 1) = 0
# else:
# strs += "0"
# # right shift by 1
# num >>= 1
# return strs
# function to reverse the string
#def reverse(strs):
# print(strs[::-1])
# Driver Code
#num = 14
#print("Binary of num 19 is:", end=" ")
#reverse(DecimalToBinary(num))
NumInput = int(input("What decimal number would you like to convert to binary?"))
#x = int(NumInput)
def DecBinConversion(x):
for i in range(31, -1, -1):
k = x >> i
if (k & 1):
print("1", end="")
else:
print("0", end="")
x = NumInput
DecBinConversion(x)