1- """
2- doctests
3-
4- >>> decimal_to_binary(3,[1.5])
5- ['0.00.01.5']
6-
7- >>> check(['0.00.01.5'])
8- ['0.00.01.5']
9-
10- >>> prime_implicant_chart(['0.00.01.5'],['0.00.01.5'])
11- [[1]]
12-
13- >>> selection([[1]],['0.00.01.5'])
14- ['0.00.01.5']
15- """
161def compare_string (string1 , string2 ):
2+ """
3+ >>> compare_string('0010','0110')
4+ '0_10'
5+
6+ >>> compare_string('0110','1101')
7+ -1
8+ """
179 l1 = list (string1 ); l2 = list (string2 )
1810 count = 0
1911 for i in range (len (l1 )):
@@ -26,6 +18,10 @@ def compare_string(string1, string2):
2618 return ("" .join (l1 ))
2719
2820def check (binary ):
21+ """
22+ >>> check(['0.00.01.5'])
23+ ['0.00.01.5']
24+ """
2925 pi = []
3026 while 1 :
3127 check1 = ['$' ]* len (binary )
@@ -45,6 +41,10 @@ def check(binary):
4541 binary = list (set (temp ))
4642
4743def decimal_to_binary (no_of_variable , minterms ):
44+ """
45+ >>> decimal_to_binary(3,[1.5])
46+ ['0.00.01.5']
47+ """
4848 temp = []
4949 s = ''
5050 for m in minterms :
@@ -56,6 +56,13 @@ def decimal_to_binary(no_of_variable, minterms):
5656 return temp
5757
5858def is_for_table (string1 , string2 , count ):
59+ """
60+ >>> is_for_table('__1','011',2)
61+ True
62+
63+ >>> is_for_table('01_','001',1)
64+ False
65+ """
5966 l1 = list (string1 );l2 = list (string2 )
6067 count_n = 0
6168 for i in range (len (l1 )):
@@ -67,6 +74,13 @@ def is_for_table(string1, string2, count):
6774 return False
6875
6976def selection (chart , prime_implicants ):
77+ """
78+ >>> selection([[1]],['0.00.01.5'])
79+ ['0.00.01.5']
80+
81+ >>> selection([[1]],['0.00.01.5'])
82+ ['0.00.01.5']
83+ """
7084 temp = []
7185 select = [0 ]* len (chart )
7286 for i in range (len (chart [0 ])):
@@ -104,6 +118,10 @@ def selection(chart, prime_implicants):
104118 chart [j ][i ] = 0
105119
106120def prime_implicant_chart (prime_implicants , binary ):
121+ """
122+ >>> prime_implicant_chart(['0.00.01.5'],['0.00.01.5'])
123+ [[1]]
124+ """
107125 chart = [[0 for x in range (len (binary ))] for x in range (len (prime_implicants ))]
108126 for i in range (len (prime_implicants )):
109127 count = prime_implicants [i ].count ('_' )
0 commit comments