Traditional Program :D

July 27, 2010 at 1:37 am (Python)

Ok. Lets start with our traditional program, the Hello world program.

The main purpose of IDLE and python terminal is to dynamically check whether the code we entered is correct or not.

In both IDLE and in terminal, you can write the hello world program as

>>>print ‘Hello world’

Hello world

>>>print “Hello world”

Hello world

>>> print “hello ‘w’orld”
hello ‘w’orld

The last line will give you a clear explanation about how the quotations will be treated in python. You can use both single and double quotations which will act independent of each other.

Writing a *.py Program:

As I said earlier, I like to use gedit to type programs. You can use any other editors of your wish, but don’t forget to save the file with “.py” extension. I opened up gedit and I typed the following lines.

print ‘Hello World’

I saved the above file as

Now I opened terminal and I typed

devil@devil-laptop:~$ python
Hello world

Yay. I ran the Hello World program 🙂

Isn’t it simple???

Try it =]


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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: