The computer is an invention that in my view is the best work of art by man to date. But a computer is just a tool which without other tools like a program won’t be able to do anything much. A computer can do many tasks at an incredible speed and accuracy but it does this by taking instructions from a program. Say you wanted to calculate the BMI (Base to Mass Index), you will have to do several things. The data needed to get this value is the height in meters squared and the weight in kg. Naturally, the computer will be able to compute this, but the computer is not aware of such things as height and weight. Therefore, it is necessary to instruct the computer to:
- accept a number representing the weight
- accept a number representing the height;
- divide the former value by the latter and store the result in the memory;
- Display the result (representing the BMI) in a readable format.
These four simple actions form a program. Of course, these examples are not formalized, and they are very far from what the computer can understand, but they are good enough to be translated into a language the computer can accept. Language is the keyword and a computer is like a well-trained dog ready to accept these instructions.
According to my friend~ google, a language is a system of communication used by a particular country or community. We have many languages even the body language which does not require speaking or writing. Computers have their own special language called machine language. What makes a language be it your mother tongue or a machine language?
- Alphabets: the basic elements in a system which combine to form complex entities e.g. what we are used to A-Z
- Lexical: also known as a dictionary. A book or electronic resource that lists the words of a language (typically in alphabetical order) and gives their meaning, or gives the equivalent words in a different language.
- Syntax: the arrangement of words and phrases to create well-formed sentences in a language. To be specific to our topic we can say syntax is the structure of statements in a computer language.
- Semantics: the branch of linguistics and logic concerned with meaning e.g ‘I have a dog’ is semantically correct but ‘a dog has me is not’. NB this is the hardest part of the language to grasp.
Unfortunately, this tongue is a far cry from a human mother tongue. We all (both computers and humans) need something else, a common language for computers and humans, or a bridge between the two different worlds. we need a language in which humans can write programs and a language that computers may use to execute the programs, one that is far more complex than machine language and yet far simpler than natural language.
Such languages are often called high-level programming languages (Python, C++, and java). They are at least somewhat similar to natural ones in that they use symbols, words, and conventions readable to humans. These languages enable humans to express commands to computers that are much more complex than those offered by ILs.
A program written in a high-level programming language is called a source code (in contrast to the machine code executed by computers). Similarly, the file containing the source code is called the source file. Computer programming is the art of using a language that can be both understood by you and the computer with the goal of producing a certain effect or result like in our example above calculation of the BMI. This composition or art should fall within the four boundaries that make a language as discussed above otherwise your program will be useless. This is what we will strive to achieve in this journey of ours.
Let's assume that you've successfully written a program. How do we persuade the computer to execute it? You have to render your program into machine language. Luckily, the translation can be done by a computer itself, making the whole process fast and efficient. There are two different ways of transforming a program from a high-level programming language into machine language:
1. Compilation- is the process the computer takes to convert a high-level programming language into a machine language that the computer can understand. The software which performs this conversion is called a compiler. Only the user has to have the compiler - the end-user may use the code without it. Think Microsoft word.
2. Interpretation - an interpreter is a computer program that directly executes instructions written in a programming or scripting language, without requiring them previously to have been compiled into a machine language program. Both you and the end-user have to have the interpreter to run your code. Think python.
What is Python?
Python is a widely-used, interpreted, object-oriented, and high-level programming language with dynamic semantics, used for general-purpose programming. Python was created by Guido van Rossum, born in 1956 in Haarlem, the Netherlands. Of course, Guido van Rossum did not develop and evolve all the Python components himself. The speed with which Python has spread around the world is a result of the continuous work of thousands (very often anonymous) programmers, testers, users (many of them aren't IT specialists) and enthusiasts, but it must be said that the very first idea (the seed from which Python sprouted) came to one head - Guido's. In 1999, Guido van Rossum defined his goals for Python:
- an easy and intuitive language just as powerful as those of the major competitors;
- open-source, so anyone can contribute to its development;
- code that is as understandable as plain English;
- Suitable for everyday tasks, allowing for short development times.
There are many programming languages out there but why python? Well if you read my last article (link) I would like to add the below the why list,
- it's easy to learn
- it's easy to teach
- it's easy to use for writing new software
- it's easy to understand
- it's easy to obtain, install and deploy
I would like to iterate that python is the only solution of its kind in the computer programming market.
There are two versions of python Python 2 and Python 3
We are going to use Python 3 in this blog because the active development of python 2 should have been stopped but hasn't, do some googling has been stopped this year (2020). To be precise we will be using the latest version of python which is python 3.9..