Files
mathgenerator/mathgenerator/funcs/decimal_to_binary.py
2020-10-20 11:30:55 -04:00

16 lines
355 B
Python

from .__init__ import *
def DecimalToBinaryFunc(max_dec=99):
a = random.randint(1, max_dec)
b = bin(a).replace("0b", "")
problem = "Binary of " + str(a) + "="
solution = str(b)
return problem, solution
decimal_to_binary = Generator("Decimal to Binary", 14, "Binary of a=", "b",
DecimalToBinaryFunc)