MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / decimal_to_binary

Function decimal_to_binary

boolean_algebra/quine_mc_cluskey.py:52–64  ·  view source on GitHub ↗

>>> decimal_to_binary(3,[1.5]) ['0.00.01.5']

(no_of_variable: int, minterms: Sequence[float])

Source from the content-addressed store, hash-verified

50
51
52def decimal_to_binary(no_of_variable: int, minterms: Sequence[float]) -> list[str]:
53 """
54 >>> decimal_to_binary(3,[1.5])
55 ['0.00.01.5']
56 """
57 temp = []
58 for minterm in minterms:
59 string = ""
60 for _ in range(no_of_variable):
61 string = str(minterm % 2) + string
62 minterm //= 2
63 temp.append(string)
64 return temp
65
66
67def is_for_table(string1: str, string2: str, count: int) -> bool:

Callers 1

mainFunction · 0.85

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected