I'm developing a function func(lvars,lconsts)
that, given a list with all variables in a certain operator and a list
with all constants in the current state, computes a list
with all possible assignments of constants to variables.
func(['X','Y'],['a','b'])
The expected output:
[{'X':'a','Y':'a'},{'X':'b','Y':'a'},{'X':'a','Y':'b'},{'X':'b','Y':'b'}]
I tried to use itertools like this:
def func(lvars,lconsts):
return list(itertools.product(lvars, lconsts))
but instead of the expected output im getting this:
[('X', 'a'), ('X', 'b'), ('Y', 'a'), ('Y', 'b')]