February 14

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 is Learning Python in 10 minutes that collects in a single post the basic Python syntax.

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.



You may also like

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Subscribe to our newsletter now!

Get instant access to the Master C# 9 webinar to learn all the new exciting C# 9 features quickly.
Get regular videos and news on C# and .NET and offers on products and services to master C#.

We will collect, use and protect your data in accordance with our Privacy Policy.