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!

Learn to be a Pythonista!

Python Playground

Learn to be a Pythonista! Try Python

Python Playground is a collection of fun programming projects that will inspire you to new heights. You'll manipulate images, build simulations, and interact with hardware using Arduino & Raspberry Pi. With each project, you'll get familiarized with leveraging external libraries for specialized tasks, breaking problems into smaller, solvable pieces, and translating algorithms into code.

$ Check price
29.9529.95Amazon 4 logo(14+ reviews)

More Python resources

Aching back from coding all day?

Acupressure Mat & Pillow

Aching back from coding all day? Try Back Problems

Relieve your stress, back, neck and sciatic pain through 1,782 acupuncture points for immediate neck pain relief. Made for lower, upper and mid chronic back pain treatment, and improves circulation, sleep, digestion and quality of life.

$$ Check price
144.87144.87Amazon 4.5 logo(1,890+ reviews)

More Back Problems resources