Try it here
Python for beginners

Learning Python Part 1



Python includes the following keywords:

and del global not with
as elif if or yield
assert else import pass
break except in raise
class finally is return
continue for lambdatry
def from nonlocal while

Interpreter and compiler

Python is a high-level language intended to be relatively straightforward for humans to read and write and for computers to read and process. Other high-level languages include Java, C++, PHP, Ruby, Basic, Perl, JavaScript, and many more. The actual hardware inside the Central Processing Unit (CPU) does not understand any of these high-level languages.

The CPU understands a language we call machine language. Machine language is very simple and frankly very tiresome to write because it is represented all in zeros and ones:


Machine language seems quite simple on the surface, given that there are only zeros and ones, but its syntax is even more complex and far more intricate than Python.

So very few programmers ever write machine language. Instead we build various translators to allow programmers to write in high-level languages like Python or JavaScript and these translators convert the programs to machine language for actual execution by the CPU.

programming language translators fall into two general categories: (1) interpreters and (2) compilers.

An interpreter reads the source code of the program as written by the programmer, parses the source code, and interprets the instructions on the fly. Python is an interpreter and when we are running Python interactively, we can type a line of Python (a sentence) and Python processes it immediately and is ready for us to type another line of Python.

Some of the lines of Python tell Python that you want it to remember some value for later. We need to pick a name for that value to be remembered and we can use that symbolic name to retrieve the value later. We use the term variable to refer to the labels we use to refer to this stored data.

>>> x = 3
>>> print(x)
>>> y = x * 4
>>> print(y)

In this example, we ask Python to remember the value three and use the label x so we can retrieve the value later. We verify that Python has actually remembered the value using print. Then we ask Python to retrieve x and multiply it by four and put the newly computed value in y. Then we ask Python to print out the value currently in y.

Python Written in which language

Now at this point in our discussion of compilers and interpreters, you should be wondering a bit about the Python interpreter itself. What language is it written in? Is it written in a compiled language? When we type "python", what exactly is happening?

The Python interpreter is written in a high-level language called "C". You can look at the actual source code for the Python interpreter by going to and working your way to their source code. So Python is a program itself and it is compiled into machine code. When you installed Python on your computer (or the vendor installed it), you copied a machine-code copy of the translated Python program onto your system. In Windows, the executable machine code for Python itself is likely in a file with a name like:


That is more than you really need to know to be a Python programmer, but sometimes it pays to answer those little nagging questions right at the beginning.

Writing a program

To write a program in Python, we use a text editor to write the Python instructions into a file, which is called a script. By convention, Python scripts have names that end with .py. To execute the script, you have to tell the Python interpreter the name of the file. In a command window, you would type python as follows:

$ cat
print('Hello world!')
$ python
Hello world!

The "$" is the operating system prompt, and the "cat" is showing us that the file "" has a one-line Python program to print a string.

We call the Python interpreter and tell it to read its source code from the file "" instead of prompting us for lines of Python code interactively.

The proper way to say "good-bye" to Python is to enter quit() at the interactive chevron >>> prompt.

But you will notice that there was no need to have quit() at the end of the Python program in the file. When Python is reading your source code from a file, it knows to stop when it reaches the end of the file.

Below is an example with quit()

>>> print('Hello world!')
Hello world!
>>> quit()

We will continue the discussion in Learning Python Part 2...

Meanwhile you can check How to download and Install Python on Windows .
read also Python database connection

Writer profile pic

Uk01 on Apr 14, 2020 at 12:01 am

If you like and would like to contribute, you can write your article here or mail your article to . See your article appearing on the main page and help others to learn.

Post Comment

Comments( 3)

Commenter Profilr Pic

Ashish on Jan 07, 2019 at 12:00 am

When will Python Part 2 come??

Commenter Profilr Pic

Admin on Apr 29, 2019 at 12:00 am

Python learning Part2 has come now.

Commenter Profilr Pic

admin on Jan 07, 2019 at 12:00 am

Soon.. Please subscribe to so that you will be notified whenever the content is added.


Forgot Password

Please enter your email address below and we will send you information to change your password.