Python - Logic Gates

giovanniesdiaz 2,576 views 10 slides Oct 02, 2014
Slide 1
Slide 1 of 10
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10

About This Presentation

Python Inheritance Logic Gates And Circuits.


Slide Content

Inheritance: Logic Gates and Circuits By: Giovannie Sanchez Kevin Flores

Important to know… Inheritance -  is the ability for one class to be related to another class. The structure relationship is called inheritance hierarchy. Lists, tuples, and strings are all types of sequential collections. They all inherit common data and organization and operands

What is Heriarchy? & What are we using? Heriarchy is used to simplify and to understand the relationship between inheritable classes. Its more organized.

The operands and, or… And – has two inputs, and one output which can be either 0 (false) or 1(true ). Or – has two inputs and its output is either true (1) if a veritable solution is present out of the two inputs or its completely false.

The operand or… Not – has a single input and the output is always the opposite of the input.

The Circuit… The output lines from the two AND gates feed directly into the OR gate, and the resulting output from the OR gate is given to the NOT gate. If we apply a set of input values to the four input lines (two for each AND gate), the values are processed and a result appears at the output of the NOT gate.

Let’s get started… LogicGate At the top of the hierarchy, the LogicGate  class represents the most general characteristics of logic gates: namely, a label for the gate and an output line. The next level of subclasses breaks the logic gates into two families, those that have one input line and those that have two. Below that, the specific logic functions of each appear.

The Connectors…are… Connector Class The Connector class will not reside in the gate hierarchy. It will, however, use the gate hierarchy in that each connector will have two gates, one on either end. This relationship is very important in object-oriented programming. It is called the  HAS-A Relationship

Let’s look at the code… Source Code 7 Classes Each one inherit except the LogicGate and Connector Method Inherit Logic Gate 3 NO Binary Gate 4 YES Unary Gate 3 YES And Gate 2 YES Or Gate 2 YES Not Gate 2 YES Connector 3 NO