I'm a beginner in Python. I'm tring to convert a text string into its DNF form using PyEDA. My code works fine for this string.
X[0]&(X[1]|X[2]) --> Or(And(X[0],X[1]), And(X[0],X[2]))
But when i try with the string mentioned below, it does not work as intended. Could anyone help me figure out what is going wrong?
Thanks!
input string:
X[0]&(X[1]|X[2])&X[3]|X[0]&X[3]
intended output:
or(and(X[0],X[1],X[3]),and(X[0],X[2],X[3]), and(X[0],X[3])
Code:
import pyeda
from pyeda.inter import *
s = 'X[0]&(X[1]|X[2])&X[3]|X[0]&X[3]'
X=exprvars('x',4)
bs = expr(s)
expression = bs.to_dnf()
expression
Current output:
And(X[0], X[3])