I am attempting to create a program that when run will ask for the boolean expression, the variables and then create a truth table for whatever is entered. I need to use a class
You probably want to do something like this:
from itertools import product
for p in product((True, False), repeat=len(variables)):
# Map variable in variables to value in p
# Apply boolean operators to variables that now have values
# add result of each application to column in truth table
pass
But the inside of the for loop is the hardest part, so good luck.
This is an example of what you would be iterating over in the case of three variables:
>>> list(product((True, False), repeat=3))
[(True, True, True), (True, True, False), (True, False, True), (True, False, False), (False, True, True), (False, True, False), (False, False, True), (False, False, False)]