Python for Beginners#1: What is programming
I have always wanted to learn programming from the internet. Unfortunately, all my previous attempts were unsuccessful. Because the taught material is either too advanced for a beginner or the teaching style is boring.
That is why I wanted to create this series of articles, so it can help you learn the fundamentals of programming simply and enjoyably!
Let us start with the most important question first.
What is Programming?
Imagine you want to communicate with your friend to perform a simple task for you. For example, you want him to bring you a cup of water.
In order for you to achieve this, both of you need to share a common language first. Otherwise, how could he understand what you want him to do exactly?
The same thing is happening when we try to communicate with the computer.
Let us say that you want the computer to perform some mathematical problem for you. Then you need to use a language that the computer can understand, which is known as a Programming Language.
So now we can say that programming is a process of giving the computer some instructions to perform a task by using a programming language.
Why do we need to give instructions to the computer?
We all know that with the power of computation we can save ourselves a lot of effort and time with just a click of a button.
A small example might be to calculate the average of students' exam scores. If you perform this task manually, it will take you a lot of time.
On the other hand, it will only require you to write a simple code, then the computer can perform the job for you easily.
So we give the computer the instructions to ease our work and also come up with accurate results.
What is an Algorithm?
An algorithm is the required steps to be performed by the computer to solve a specific problem.
In this example, we are required to calculate the area of a rectangle.
The first step always is to understand the problem clearly. Ask yourself this question, what do we need to do exactly so we can calculate the area of a rectangle?
It is clear that we need to first get the height, then the width of the rectangle. And lastly, we are going to multiply them to get the result.
Whenever we come up with the algorithm of the program, we then need to translate it to a code that the computer can understand by using any programming language we know.
This is basically the approach followed when developing any new program to solve a specific problem.
First, understand clearly what you want the computer to execute.
Secondly, try to think what are the steps required so we can get the result we want.
Lastly, use any programming language you know so the computer can understand and execute your algorithm.