Question: COMPLETE PYTHON CODE PLEASE Objectives Practice using relational/logical operators and selection statements. Learn about text file handling. Problem #1: Warm-up exercise The following table shows
COMPLETE PYTHON CODE PLEASE

Objectives
- Practice using relational/logical operators and selection statements. Learn about text file handling.
Problem #1: Warm-up exercise
The following table shows standard logic gates. Let X and Y be inputs to the dual-input gate and out be the output from the gate. The inverter has the single input X. Note that 0 is False and 1 is True.
|
|
|
|
|
|
| |||||||||||||||
| Inputs | Outputs | |||||||||||||||||||
| X | Y | AND | NAND | OR | NOR | Inverter | ||||||||||||||
| 0 | 0 | 0 | 1 | 0 | 1 | 1 | ||||||||||||||
| 0 | 1 | 0 | 1 | 1 | 0 | - | ||||||||||||||
| 1 | 0 | 0 | 1 | 1 | 0 | 0 | ||||||||||||||
| 1 | 1 | 1 | 0 | 1 | 0 | - | ||||||||||||||
| A |
| B |
| out |
| C |
| D |
| Sample Circuit |
Part 1:
Write a complete Python script that does the following:
- Prompts the user to enter values (either 0 or 1) for each of the inputs A, B, C, and D.
- Add code to validate each input value. If the entered value is not a 0, then set the value to 1.
- Determines and displays the output value out.
- Use the appropriate logical operators and selection statements to do this task.
- The logic test could be done in a single line, but you may break it up into multiple tests, if desired.
Objectives Practice using relational/logical operators and selection statements. Learn about text file handling. Problem #1: Warm-up exercise The following table shows standard logic gates. Let X and Y be inputs to the dual-input gate and out be the output from the gate. The inverter has the single input X. Note that 0 is False and 1 is True. out X X out X out out out X Y Daun Do D X Y X Y Y Inputs Y AND 0 Outputs OR 0 1 NAND 1 1 NOR 1 Inverter 1 0 0 0 1 0 0 0 1 0 0 0 1 1 0 1 1 1 1 0 A Do B C out D Sample Circuit Part 1: Write a complete Python script that does the following: Prompts the user to enter values (either 0 or 1) for each of the inputs A, B, C, and D. 0 Add code to validate each input value. If the entered value is not a 0, then set the value to 1. Determines and displays the output value out. Use the appropriate logical operators and selection statements to do this task. The logic test could be done in a single line, but you may break it up into multiple tests, if desired
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
