Logic Gates:

Logic gates is a terminology mainly used in electronic for circuit building. Similarly, when we build a digital circuit, it forms the elemental part of it. Inputs are taken, and based on the inputs, the output is generated. The output is generated in terms of 0 (low) and 1 (high). Logic gates are created for the purpose of performing calculations, data storage, or for object-oriented programming (the power of inheritance) in python for data science.

We can find seven basic logic gates. They are as follows:

  1. AND Gate

It gives output as 1 if only both the inputs are 1; otherwise, the output provided is 0. 1 means TRUE and 0 means FALSE.

Logic Gates in Python for Data Science - PST AnalyticsLogic Gates in Python for Data Science - PST Analytics

Logic Gates in Python for Data Science - PST Analytics

  1. NAND Gate:

When both inputs are 1 it returns a 0 in all other cases it returns 1.

Logic Gates in Python for Data Science - PST Analytics

  

  1. OR Gate:

This gate returns 1 if any of the inputs is 1; otherwise, it returns 0.

  1. XOR Gate:

This gate returns 1 if both inputs are different; otherwise, it returns 0.

  1. NOT Gate:

It performs inversion function. It returns the opposite of the input as output i.e., 0 will becomes 1 and 1 becomes 0 and only accepts one input.

  1. NOR Gate:
  2. XNOR Gate:Logic Gates in Python for Data Science - PST Analytics

This gate returns 1 when both inputs are the same and returns 0 when both are different.

Logic Gates in Python for Data Science - PST Analytics

If you want to learn more about logic gates in python for data science, then you can check this and this.

Leave a Reply

Your email address will not be published. Required fields are marked *