Learning the basics of Python in an evening

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 are Learning Python in 10 minutes and Python Tutorial. The first one collects in a single post the basic Python syntax. The latter consist of comprehensive tutorials with annotated screenshots.

Coding Session

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:

Ready !!!

Python Tools for Visual Studio

You can create a new project in the usual way:

Python Application in Visual Studio

and start adding files in the solution explorer:

Python Application in 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:

Python Intellisense
Python Intellisense - Autocompletion

 

Python Intellisense - Autocompletion of paramters

 

Python Intellisense - Object support

This is an extract of the code:

Example of Python Function

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.

 

Permanent link to this article: https://www.productivecsharp.com/2012/02/learning-the-basics-of-python-in-an-evening/


Warning: in_array() expects parameter 2 to be array, null given in /home/andreaa9/public_html/wp-content/themes/graphene/inc/plugins.php on line 92
>