02. Setting up Python

Head over the Python.org and download Python version 3.

To launch Python, simply type "python" onto your command line interface if you're on a Unix environment (Mac OS X or Linux). If you're on Windows, open Python's IDLE. You should see the version of Python 3.x.x, as shown below.

Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 23 2015, 02:52:03)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

Interactive mode

Python starts up in Interactive Mode. This means that you can type in some command and Python will interpret that query and output a response.

For example, try inputting a number. Python should output the number

>>> 123

Primary and Seconary prompts

Python lines will always be preceded by the primary prompt >>>. If there is an unfinished command that goes to the next line, a secondary prompt will be activated with lines preceding with ...

>>> print("Hello world!"
... )
Hello world!

Notice how a secondary prompt appeared because the parentheses was not closed.


Comments in python are preceded by a hashtag (#) to the end of the line. As long as the hashtag is not embedded within quotes, it everything proceeding it will be ignored by the interpreter.

>>> # This is a comment that won't be interpretted.

Zen of Python

Within your interpreter try typing import this to print out the Zen of Python. Here you can find Python's philosophy.

>>> import this

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

Aching back from coding all day?

Foam Seat Cushion

Aching back from coding all day? Try Back Problems

This foam seat cushion relieves lowerback pain, numbness and pressure sores by promoting healthy weight distribution, posture and spine alignment. Furthermore, it reduces pressure on the tailbone and hip bones while sitting. Perfect for sitting on the computer desk for long periods of time.

$ Check price
99.9599.95Amazon 4.5 logo(9,445+ reviews)

More Back Problems resources

Learn to be a Pythonista!

Programming for Beginners

Learn to be a Pythonista! Try Python

This book doesn't make any assumptions about your background or knowledge of Python or computer programming. You will be guided step by step using a logical and systematic approach. As new concepts, commands, or jargon are encountered they are explained in plain language, making it easy for anyone to understand.

$ Check price
24.9924.99Amazon 4.5 logo(124+ reviews)

More Python resources