Python Interpreter

This tutorial will learn about python syntax and python interpreters also how to use them to do python programming and understand various functions and methods used in interpreter in python.

Python Interpreter

Let’s get started with python basics by learning basic python and how to use Python interpreter or Python CLI. First, let us understand what a Python interpreter is.

What is Python Interpreter?

A Python interpreter reads and executes code instantly on the terminal, but it should be in a single line. In other words, we can say the python interpreter takes commands iteratively and executes them simultaneously; unlike compilers, interpreters should not require code to compile and then run. Code runs instantly.

Python syntax


Let’s make our hands dirty by executing the first python function, the Print function.

As its name suggests, the print function is used to print text using python.

print(“Hello World!)


python print()

As we have seen in the above image, the print function is used in the python interpreter, but later in our tutorial, we will use the print function in the python program or python script.

Calculations in Python Interpreter

Now we will do some necessary mathematical calculations in python using the python interpreter. We can add. Substation, multiplication, division, and many more.


>>> 2 + 2


>>> 5 – 3


>>> 10 / 5


>>> 10 / 5

Multiple Calculation

>>> 5 * 3 + 2

Python help() Function

The help() function in function is used to see the documentation of all the python syntax. Every function and method in python comes with documentation.

We can use the help() function by calling it in the python interpreter.

How to call help() function?

Python help()

When we type the help() function in the python interpreter, we will get the above result with the information regarding the python, and we can see we got another interpreter by the name of help>. We can check all the pre define documentation of all the built-in python syntax.

Lets check documentation of python print() function using help> method.

Python help() details

As we can see, when we type print, it is showing as the predefined documentation of print() function. Like it, we can also get documentation of data types like int, string, float, double, and data structures like list, set, tuple, and dictionary.

We can also check the list of all the reserved keywords available in python by typing keywords in help>

We can also check the list of all the reserved keywords available in python by typing keywords in help>


help> keywords


When we run the above command, we will get the following result.

Here is a list of the Python keywords.  Enter any keyword to get more help.

False class from or
None continue global pass
True def if raise
and del import return
as elif in try
assert else is while
async except lambda with
await finally nonlocal yield
break for not

We can check other commands like a module, topic, symbols, and type in help> interpreter.

To close the help> method, we can use the Ctrl + C key to exit it, and when we exit the help> method, we will get the following result.


You are now leaving help and returning to the Python interpreter.
If you want to ask for help on a particular object directly from the
interpreter, you can type “help(object)”.  Executing “help(‘string’)”
has the same effect as typing a particular string at the help> prompt.


Just like help, many built-in functions can be used in python interpreters, which are listed below.

abs() delattr() hash() memoryview() set()
all() dict() help() min() setattr()
any() dir() hex() next() slice()
ascii() divmod() id() object() sorted()
bin() enumerate() input() oct() staticmethod()
bool() eval() int() open() str()
breakpoint() exec() isinstance() ord() sum()
bytearray() filter() issubclass() pow() super()
bytes() float() iter() print() tuple()
callable() format() len() property() type()
chr() frozenset() list() range() vars()
classmethod() getattr() locals() repr() zip()
compile() globals() map() reversed() __import__()
complex() hasattr() max() round()


We will learn this one by one in upcoming tutorials.