Startertutorials Blog
Tutorials and articles related to programming, computer science, technology and others.
Subscribe to Startertutorials.com's YouTube channel for different tutorial and lecture videos.

Categories: Python Programming. No Comments on What is Python Shell

In this article you will learn about what is Python shell and how to use the Python shell to try out Python concepts and due simple calculations.

 

Python’s interactive command line or shell, sometimes is called as interactive prompt. The interactive prompt follows REPL (Repeat-Evaluate-Print-Loop). There are a variety of ways to start this command line: in an IDE, from a system console, and so on.

 

Assuming the interpreter is installed as an executable program on your system, the most platform-neutral way to start an interactive interpreter session is usually just to type python at your operating system’s prompt, without any arguments.

 

On Windows, you can type python or py in a DOS console window – a program named cmd.exe and usually known as Command Prompt. On Linux (and other Unixes), you might type this command in a shell or terminal window.

 

The Python interactive session begins by printing two lines of informational text giving the Python version number and other information, then prompts for input with >>> when it’s waiting for you to type a new Python statement or expression as shown in the picture below:

 

python-shell-prompt

 

When working interactively, the results of your code are displayed below the >>> input lines after you press the Enter key. For instance, here are the results of two Python print statements:

 

python-print-at-shell

 

You can see that first print statement prints Hello World and the second print statement prints Welcome to Python. The print statement in Python language is used for output. We will learn more about it in another article.

 

Python shell can be used for quickly trying out Python commands and concepts. It can also be used as a simple calculator for doing arithmetic operations and other stuff as shown in the picture below:

 

python-shell-as-calculator

 

To exit from Python shell and go back to the command prompt or terminal, either type quit( ) or exit( ).

 

Go back to introduction to python programming.

How useful was this post?

Click on a star to rate it!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Suryateja Pericherla

Suryateja Pericherla, at present is a Research Scholar (full-time Ph.D.) in the Dept. of Computer Science & Systems Engineering at Andhra University, Visakhapatnam. Previously worked as an Associate Professor in the Dept. of CSE at Vishnu Institute of Technology, India.

He has 11+ years of teaching experience and is an individual researcher whose research interests are Cloud Computing, Internet of Things, Computer Security, Network Security and Blockchain.

He is a member of professional societies like IEEE, ACM, CSI and ISCA. He published several research papers which are indexed by SCIE, WoS, Scopus, Springer and others.

Leave a Reply

Your email address will not be published. Required fields are marked *