f=open("test.txt","r") i=0 for lines in f: i=i+1 count = 0 while i > 1: i = i / 2 count +=1 print "there are ", count, " variables in the boolean function" functionString = "" li = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"] i = 0 while i < count: if i == (count - 1): functionString = functionString + li[i] else: functionString = functionString + li[i] + "," i+=1 print 'the function is f(', functionString, ')'

So, given an input text file that looks like this:

0 1 0 0 1 0 1 1

the return when running the program would be as follows:

there are 3 variables in the boolean function the function is f( a,b,c )

What I need now is a way of determining what the DNF of the input would be. I know that the DNF is as follows:

f(a,b,c) = a’b’c | ab’c’ | abc’ | abc (where the and operation is simply when no symbol is present, ' is the "not" operator, and | is the or operator.

I realize this is combining python knowledge with some mid level college math so not expecting an overflow of responses but any help would be greatly appreciated. anyone looking for a challenge this thread is for you! For those braniacs that think this is a simple brain teaser, please enlighten me!

Thanks in advance,

T.

This post has been edited by **troegs**: 09 February 2009 - 01:01 AM