Home / Computer Science / Python / What is Python Shell

What is Python Shell

In the previous postings, we learn python is an interpreter language that means it executes line by line of code. Python comes with interactive shell known as python shell which is used to execute python coding lines or commands and the results view instantly after execution of the command.

See the below in the python shell.

Python Shell
Python Shell

>>> print ("hello")
>>> print 2+3
>>> print 2/5

Type a code or instruction and then press enter it gives results instantly like above.
To use python shell in your PC, type python in run and find Python Command line and click on that, the above screen is opened that is python shell.
Till now we learn the single command execution, in the case multiple line of code or python file execution follow the below steps.
Unlike Java and c python programs also execute from cmd.

Create python program in note pad or python environment and save that file extension with .py. (remember that file location).

num1 = 1.5
num2 = 6.3
# Add two numbers
sum = float(num1) + float(num2)
# Display the sum
print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))

I saved the above file with name sum.py in Documents folder.


Open Command prompt and change directory to Documents.

See the below snap I was navigating to Documents folder.

Python Shell
Python Shell


Execute out program by typing Python Sum.py
Python programname.py (press enter) the program will execute. See below picture.

Python Program Execution
Python Program Execution

About santosh G

Hi, i am Santosh Gadagamma, a tutor in Software Engineering and an enthusiast for sharing knowledge in Computer Science and other domains. I developed this site to share knowledge to all the aspirants of technologies like, Java, C/C++, DBMS/RDBMS, Bootstrap, Big Data, Javascript, Android, Spring, Hibernate, Struts and all levels of software project design, development, deployment, and maintenance. As a programmer I believe that, “The world now needs computers to function.” Hope, this site guides you as a learning tool towards greater heights. I believe that Education has no end points and i wish to learn more in the process of teaching you….,

Check Also

Python Installation and Environment Setup

Python Installation Checking: As python is most widely used language so before installing python in …