Homework/Hacks

our homework we have decided for a decimal number to binary converter. You must use conditional statements within your code and have a input box for where the decimal number will go. This will give you a 2.7 out of 3 and you may add anything else to the code to get above a 2.7.

Below is an example of decimal number to binary converter which you can use as a starting template.

def DecimalToBinary(number):
    if number > 1:
        DecimalToBinary(number//2)
    print(number%2, end = "")
 
# function to reverse the string
number = int(input()) 
print("The binary for", number, "is: ", end = "")
DecimalToBinary(number)
# Driver Code
The binary for 24 is: 11000