CHAPTER 1

image

Hello Python

Let’s review a simple Python program that will explain the use of the Python Interactive Shell along with a few tips.

Python’s Interactive Shell

Once you have Python installed on your system, you can use the Interactive Shell to try simple lines of code, debug some problematic code, and even use it as a simple calculator.

In a terminal (Linux) or Command Prompt (Windows), simply type:

python

If you are running on Linux, you will see something like this:

Python 2.7.3 (default, Apr 10 2013, 05:09:49)[GCC 4.7.2] on linux2Type "help", "copyright", "credits" or "license" for more information.>>>

Or if you are running on Windows ...

Get The Python Quick Syntax Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.