Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 Casesimage text in transcribed 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

More Books

Students also viewed these Databases questions