Python Tutorial 2 – Basic Programming Concepts

Python Tutorial 2 – Basic Programming Concepts

Hi Friends, Today we we will be discussing about some basic Python programming concepts. We have seen details about what Python language is. We have also seen how Java and Python differ from each other in below Python Tutorial.

Refer these tutorials:

Now it’s time to put our hands-on actual Python programs. However, before we actually dive into programs, let’s just brush up some of the basic concept generic to any programing language. Basically, they are computer fundamentals.

What is machine language: A language that a computer can understand to perform a given task.
What is a task: A task is nothing but a command given to a computer to perform some operation.
What is instruction list: A complete list of commands that a computer can understand is Instruction list.

Just like we have our natural language like English, and we have alphabets to write English, similarly we have machine language which is computers language and instruction list is the alphabet of this language.

That said, now we need a language which we can use to write programs and which computer can execute. They are called as higher-level programming languages like Python, Java etc. The programs written in these languages is called as source code and file containing this code is source file.

Python and its other implementations:

Python 2 is older version of Python. Python 3 is new version and is in use currently. Remember that Python 2 and Python 3 are not compatible with each other. Hence, it’s better to use Python 3 to get all the new features of the language.

The primary community tasked to develop, improve, expand and popularize Python is Python Software Foundation (PSF). The Python developed by this community are called as reference pythons and any other implementation of Python should follow the standards set by PSF.

PSF Python is written in C hence also sometimes called as CPython. Python programs can be easily ported and migrated to any platform and can compile and run C programs.

Cython: Its only purpose is to easily translate the Python code into C code. This is particularly important when you are using some very complicated and complex mathematical calculations.

Jython: It is Python written in Java. May be useful when you want to utilize Java code with added Python functionalities. Jython uses Python 2 version.

PyPy: Python written in Restricted Python language. It’s a subset of Python and cab be used when deploying some new features. Instead of directly putting new features in main python, they can be tested first in PyPy.

Installing Python is very easy. Go to https://www.python.org/ site, go to Download and download/install python.

Python 3 itself contains an editor to write programs called as IDLE (Integrated Development and Learning Environment). You can write the programs and see the results.

Either you can directly write your programs here or you can choose to create a file and write programs in the file. Just go to File heading, click on New File, write you code and save it with default extension of .py. Run using F5. You can close the file and open it later, make changes and run again.

Other Links: Automation using Python and Selenium https://mytechdevice.com/automation-using-python-and-selenium-webdriver/

Leave a Reply

Your email address will not be published.