Sign in to test your solution.
# Denary to binary program # ------------------------- # Subprograms # ------------------------- def den_to_bin(number): binary = "" while number > 0: remainder = number % 2 binary = str(remainder) + binary number = number // 2 return binary # ------------------------- # Main program # ------------------------- number = int(input("Enter the denary number to convert: ")) print("Binary:", den_to_bin(number))

  Python sandbox

This window allows you to run Python code without installing a thing. The code you write here is not automatically submitted to Dodona.

Test case being debugged