Monday, June 27, 2011

Learning Python: #1 - Hello World

My company provides four hours of free time per week to spend time learning a new technology, language, etc. I've decided to take some time to learn Python and sort of document what I learn as I go along.

I downloaded the latest Python for Windows (3.2 as of the time of this post) and started reading the documentation (Here is a link to a tutorial for Python 3.2.). It was easy to get Python downloaded and setup to run from the cmd window in Windows 7. All that I needed to do after downloading Python was to add the install directory to the Path Environment variable.

When I'm learning a language it typically does not take long to learn the syntax to make a Hello World application; however, it took me a little bit longer than normal with Python. What took me so long with Python and what is important to note is that the syntax has changed since 2.7.2, which is the version of the documentation I happened to be reading. I was typing >>> print "Hello World" but for 3.2 it should have been >>> print ("Hello World") with the text wrapped in parens.

The first gives an error 'File "<stdin>", line 1' while the second does what is expected and actually prints out the text of 'Hello World'.

I'm eager to put my free time to use learning something and growing as a developer.

No comments:

Post a Comment