Installing Python 3.6 on Ubuntu

Since I have been getting a lot of questions about installing Python 3.6 on Ubuntu, I thought I could put together a document for quick reference. The default version of Python on Ubuntu (until 17.04) is Python 3.5. To download and install Python 3.6, follow the commands given below based on your version of Ubuntu.

Ubuntu 14.04 (Trusty), 16.04 (Xenial)

If you are using Ubuntu 14.04 or 16.04, you can use Felix Krull’s deadsnakes PPA at https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa:

Command 1:

sudo add-apt-repository ppa:deadsnakes/ppa

ubuntu_img1

Command 2:

sudo apt-get update

ubuntu_img2

Command 3:

sudo apt-get install python3.6

ubuntu_img3

Alternatively, you can use J Fernyhough’s PPA at https://launchpad.net/~jonathonf/+archive/ubuntu/python-3.6:

sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6

Ubuntu 16.10, 17.04

If you are using Ubuntu 16.10 or 17.04, then Python 3.6 is in the universe repository, so you can just run:

sudo apt-get update
sudo apt-get install python3.6

After installation for Ubuntu 14.04, 16.04, 16.10 and 17.04

To invoke the Python 3.6 interpreter, run python3.6.

Ubuntu 17.10 and 18.04 (Bionic)

Ubuntu 17.10 and 18.04 already come with Python 3.6 as default. Just run python3 to invoke it.

Advertisements

Binary Logic Circuits

Logic circuits are used to build digital computers, ones that are enabling your engagement with this very blog post. These perform operations on digital signals, which is essentially restricting the signal from electric circuits to a few discrete values. For example, decimal logic circuits have values from 0 to 9. The discrete values are fewer in the case of binary logic circuits, where the result is either a 1 or a 0.

Let us address the case of binary logic circuits in this post.

The simplest binary logic that we interact with on a regular basis is a switch. It has two values – ON or OFF.

Think of our control input to be a variable, s. If we provide no input, the value of s = 0 or s = LOW and the circuit is considered “open”. If we provide an input, the value of s = 1 or s = HIGH and the circuit is now “closed”.

If we apply this to the case of our switch, think of no input as leaving your switch at OFF (s = 0). In this case, our circuit is open and the bulb or fan you want to control stays turned off. If we decide to switch our electric equipment ON (s = 1), we end up closing the circuit and setting the fan in motion.

States of a switch
Table 1: States of a switch

Table 1 provides a simple representation of our logic, an approach called the Truth Table representation. As we can gather from the Truth Table, our output is equal to the control input we provide our circuit. In the case of digital logic circuits, we define the output (also called Logic Function) to be a function of our control input variable. For our switch, the logic function equals the control input and is represented as:

F(s) = s

Now we have our first binary logic expression!

This idea can be extended to introduce basic logic functions (AND, OR, NOT) and subsequently build a logic network that has a combination of these gates.