# Revision history [back]

### How to get the variables present in an boolean expression

Consider the boolean variables x, y and z.

I need something like

 sage: variables(x+yz)
[x, y, z]
sage: variables(x+z)
[x, z]


What should I do?

For a starting point, you may like (copied from the answer given here):

sage: R = BooleanPolynomialRing(3, 'x')
sage: x, y, z = R.gens()


### How to get the variables present in an boolean expression

Consider the boolean variables x, y and z.

I need something like

 sage: variables(x+yz)
[x, y, z]
sage: variables(x+z)
[x, z]


What should I do?

For a starting point, you may like (copied from the answer given here):

sage: R = BooleanPolynomialRing(3, 'x')
sage: x, y, z = R.gens()