d = ['X + Y = Z', 'X <=Y']
p = [{'Y': 1, 'X': 0, 'Z': 0}, {'Y': 1, 'X': 0, 'Z': 3}, {'Y': 1, 'X': 0, 'Z': 6}, {'Y': 1, 'X': 0, 'Z': 9}, {'Y': 1, 'X': 1, 'Z': 0}, {'Y': 1, 'X': 1, 'Z': 3}]
I need to create create some structure which would store List of expressions, where variables are changed.
I need to know:
X, Y, Z current values
expressions with changed letters to integers
and it has to be for each dict of values
The problem is to see for what X,Y,Z, all expressions are True
According the expressions are made by you (so you can trust them), a simple solution is to use eval() like this :
but you’ll have to correct the expression
X + Y = Zis not valid python,X + Y == Zis a valid python expression.But with the values you gave in example, nothing is matching 🙁