This page is intented to give people a quick starting guide to the programming language Python. The content is directed to developers trying out Python for the first time, as well as people who are new to programming and try to get up to speed quickly with pratical examples. A quick word of advice especially for the newbies - do not get discouraged - I spend a lot of time on stackoverflow(great ressource to check if you are stuck), meaning: programming is like life-long learning; you will never have mastered everything. And always remember: Fear is the path to the Dark Side
.
If you really do not have much time and just want to get a glimpse of python you can go to http://learnpython.org/. There you will learn the most basic python commands interactively without having to setup your own environment.
However, if you want to run the code locally and also get a deeper look into python and how to write programs you might want to read on.
Without further ado lets get you started!
Python was ported to many platforms and might in fact already be running on your system. But we still have to make sure that you are running a compatible version.
Please do not download Python 3.x
, as it is a newer version, which at this point does not provide the learning packages we use in this tutorial.
Here we just need to make sure that you have a relatively new python version. This will make your life a lot easier. Just open the terminal
-app (e.g.: mac-os-x, linux ubuntu) and type the following:
python --version
You should get something like Python 2.7.6
. Everything above Python 2.6.x
and below Python 3.x
should be more than enough for this tutorial. If you have a lower version number, please go to the official python website and download the newest version.
It is not very likely that you have Python installed without your knowledge, so you can just go to the official python website and download the newest Python 2.7.x
for windows there.
The teaching tool I am using is called iPython notebook.
Open your terminal and type the following
easy_install ipython zmq mathlib numpy pandas tornado jinja2
You might receive a permission error message during your installation. Simply run the same command with a sudo
in front of it. This will run the command in system administrator mode and install the packages properly.
You can test your setup by running:
ipython notebook --pylab inline
Install the setuptools, if needed. if needed
in this case means that you have to check if the easy_install.exe
is present in the folder C:\Python27\Scripts
.
cd C:\Python27\Scripts
.\easy_install.exe ipython[zmp]
.\easy_install.exe mathlib
.\easy_install.exe numpy
.\easy_install.exe pandas
.\easy_install.exe tornado
.\easy_install.exe jinja2
You can test the server by running:
ipython notebook --pylab inline
Download the project as a zip(pydawans-master.zip
) file and unpack it(or if you have experience with github you can also checkout
this repository).
cd <PATH-TO-UNPACKED-FOLDER>
### e.g.: (Mac, Linux)
### cd /Users/marco/Downloads/pydawans-master/
### (Windows)
### cd C:\Downloads\pydawans-master\
ipython notebook --pylab inline
The following browser window should open(there might be more entries):
Just click on the exercises and play with them.
FYI: Until I have had the time to write exercise 0 - how to work with ipython notebook
you might want to familarize yourself with it yourself either here or here or simply by googling.