By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,972 Members | 1,115 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,972 IT Pros & Developers. It's quick & easy.

Creating Truth Table Given Expression

P: 1
I need to create a truth table (as a list of lists) given an expression (string). I was given a function to extract the variables. I need to complete this method recursively.
An expression could be "a or b", "(a and b) or c", etc.

I am very new to python, so I am not familiar with a lot of the built in functions.
Some of the things I'm confused on is how to get the operators from the expression?
How to evaluate the expression at every possible value for each variable?

This function is just very confusing to me in general. Any help is appreciated.
Sep 26 '17 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.