So I've currently got a function that allows the user to give an integer and can distinguish between an integer and an exiting string, as well as a random on. However I'm struggling with making another function that will convert this integer into a binary number, I know that'll require floored division and modulo, but I'm relatively lost here.
def getInt(question):
return (question)
print("Welcome to Binary Printer")
print('Enter exit to quit at any time.')
i=True
while i:
question=input("Enter a Positive Int:\n")
try:
if(question=="Exit") or (question=="exit"):
i=False
print("")
else:
integer_check=int(question)
except ValueError:
print("Not a Number.")
def binaryStr(num,bits):
num=getInt(question)
bits=int(input("Number of Bits:\n"))
for num in range(0,255):
one_or_zero=num%2
if one_or_zero>0:
one_or_zero//2
else:
return one_or_zero
def main():
getInt(question)
binaryStr(num,bits)
main()