You are welcome to this tutorial on Python programming. For some persons, this could be their first time to come across this programming language, while for some, it is for revision purposes. So, don't panic, regardless of the category you find yourself in, in the python package, you will be taught the basics.
In addition, experienced or intermediate learners could have the advantage of picking up topics and lessons of their choice, however, we recommend you not to hurry through the topics, even though Python, although a normal programming language, have some scary parts for programmers, so we will advise you to follow each tutorial one after the other.
Of recent, developers believe that Python is one of the most versatile programming languages. For those who have other programming language experience, you will notice the difference in course of the tutorial.
What are the Features of Python?
Below are some of the features of Python
Below is an example to show us how simple python syntax could be. In this example, we want the user to enter something from the keyboard and we want to save the value in a variable. If we use the C++ programming language, this is how the code will be written:
#include<iostream>
using namespace std;
int main(){
int x;
cin >> x;
return 0;
}
Let’s use Core Java, another programming language:
import java.util.Scanner;
class Test{
Scanner input = new Scanner(System.in);
public static void main(String args[]){
int x;
x = input.nextInt();
}
}
Now, with Python:
x = input()
You can see how easy it is with Python; no file importing, no curly braces, no semicolons, and with just a single line. This has shown you how Python can be a programmer's relief.
In addition, you will notice from the examples above; with the C++ and Java code, the user can only type any integer as the input to variable x, this is because value x has been declared as an integer by specifying the code “int x;”. while, with Python, the programmer doesn't have to explicitly specify the data type while declaring a variable, as the Python compiler will do that based on the type of value assigned to the variable.
Currently, there are two releases of Python on its official website and they are Python 2.x and Python 3.x. However, this tutorial will be based on Python 3.x. But, the are no major changes between Python 3.x and Python 2.x. The addition or difference is just on the 'print'; in Python 2.x we just have print, while in Python 3.x we have the print(). That is the addition of the brackets.
One can say, you can do almost anything with Python.
Below are the steps to set up a Python environment on your PC.
Step 1: Go to python.org/download
Step 2: Download the latest release for Python 3.x for 32-bit or 64-bit depending upon your PC spec.
Step 3: Open Installer and follow the steps shown below:
Step 4: Once these steps had been followed, the installation will begin immediately.
Step 5: To check whether the installation was successful, type python -V in cmd. If it returns the Python version was installed, then congratulations you are ready to start.