Question: please give resolution in PYTHON Program 5: Compound Proposition Truth Table Create a program that prompts the user for a compound proposition composed of the

please give resolution in PYTHON

Program 5: Compound Proposition Truth Table

Create a program that prompts the user for a compound proposition composed of the variables p, q and then prints the truth table for the compound proposition.

Program Requirements:

First, ask the user 3 questions:

Question 1- Do you want to AND or OR the two propositional variables?

Question 2- Do you want to NOT p?

Question 3- Do you want to NOT q?

Second, using the answers to the three questions, generate a compound proposition, calculate the truth value for each combination, and display the truth table. Repeat the prompt and calculation until the user enters a sentinel value to quit.

The truth table should include 3 columns: p, q, and answer. Other intermediate columns are optional.

  • Output (after the three questions) should contain 5 rows:
  • The first row should display column headers (using the correct symbols)
    • Use: V for OR, A for AND, and ~ for NEGATION as the symbols for displaying the logical operators. (other symbols may or may not not show correctly on all computers)
  • The last 4 rows should contain the values of the truth table.

For example:

Do you want to AND or OR the variables (and/or): and

Do you want to NOT p (y)? y

Do you want to NOT q (y)? n

Answer:

p q ~p A q
T T F
T F F
F T T
F F F

Additional Requirements:

  • The first two columns should contain the ORIGINAL values of p,q.
  • Do not hard code the truth values. They must be calculated.
  • Provide some test cases . Refer to Developing Test Cases please give resolution in PYTHON Program 5: Compound Proposition Truth Table in the Getting Started module for my expectations on test cases.

Program: 45 / 45 Test Cases: 5 / 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!