Python - Basic Programming Concepts
In this post, we will talk about some basic Python programming concepts. Now it’s time to put our hands-on actual Python programs. However, before we actually dive into programs, let’s just brush up on some basic concepts generic to any programming language.
Computer FundamentalsMachine Language: A language that a computer can understand to perform a given task. Task: A task is nothing but a command given to a computer to perform some operation. Instruction List: A complete list of commands that a computer can understand is an instruction list. Just like we have our natural language like English, and we have alphabets to write English, similarly, we have a machine language which is the computer’s language and
instruction listis the alphabet of this language. That being said, now we need a language which we can use to write programs and which computer can execute. They are called higher-level programming languages like Python, Java etc. The programs written in these languages is called source code and the file containing this code is a source file.
Python and its other implementationsPython 2 is an older version of Python. Python 3 is a newer 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 is 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 known 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 is written in Restricted Python language. It’s a subset of Python and can be used when deploying some new features. Instead of directly putting new features in the 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 known 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 your code and save it with the default extension of .py. Run using F5. You can close the file and open it later, make changes and run again.
Please share your Feedback:
Did you enjoy reading or think it can be improved? Don’t forget to leave your thoughts in the comments section below! If you liked this article, please share it with your friends, and read a few more!