Recently I’ve started learning and playing with Ruby and Python. There are similarities in both the languages – so I decided to learn them together. I installed the Python compiler (version 2.5.2) from the site – The installation went smooth. Once I clicked on the Run button in the IE Security Warning dialog the Python 2.5.2 Setup for Windows dialog was displayed

After I selected Next the Select Destination Directory dialog was shown. I kept the default folder which is C:\Python25.

I selected all the components which is the default.

Selecting next starts the installation.

Once the installation is done (within couple of seconds), the successfully installed dialog screen is shown.

Wow – that was very impressive! The installer has added a menu called Python 2.5 in the programs menu.

Selecting IDLE opens the Python Interactive Shell –

Here’s the first Hello World application in Python –

Before ending this blog post here’s a interesting fact. Note that string literals can be put in both double quotes as well as single quotes (though there are subtle differences in Ruby). So both of the followings produce the same output –

In Runy, a double-quoted string allows character escapes by a leading backslash. A single-quoted string does not do this interpreting; what you see is what you get. So a double quotes respect characters like \n, \t etc.
So when double quotes encounters \n, it creates new line, but single quote outputs it as it is. But in Python both of them are treated the same.

Ruby (irb):


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s