Python is the programming language used in programming contests for the two Udacity courses I decided to enrol in.
The courses are Building a Search Engine and Programming a Robotic Car.
I never programmed in Python before and so I decided to start learning the language.
If you already know a language like Java, C# or C++ learning Python is relatively easy.
I started to quickly read the official tutorial:
I think that it is quite good as a starting point and teach you all the basics like control flows, data structures, modules, input and output, errors and exceptions, classes and standard library.
Other interesting resources is Learning Python in 10 minutes that collects in a single post the basic Python syntax.
After the reading, I decided to start doing a simple coding session.
I decided to implement a Code Kata and in particular the Kata Four: Data Munging.
First of all, I installed the python engine:
I decided to use the version 2.7 instead of the latest 3.2. It seems that the latest is quite recent and there are lots of breaking changes. The conversion process of many libraries is still in progress.
The next step is installing the development environment.
There is a big list of editors out there to develop in Python.
I personally love Visual Studio and the idea of a single integrated environment.
I found a Python extension for Visual Studio that was perfect for me:
Python Tools for Visual Studio
You can create a new project in the usual way:
and start adding files in the solution explorer:
The tool has also some good intellisense that helps in writing code. Considering that Python is a dynamic language this is quite impressive.
Here few examples:
This is an extract of the code:
You can find the complete source code in my personal repository:
I think that the best way to learn Python is using it. I am looking forward to playing with it during the courses.