1.Hello World!

The python code can be written in a stand alone “Python Shell”. This simplifies the life of a programmer. The shell allows you to enter Python command just as we do in a command-line interface. This is a great resource for immediate Python gratification.

Here we are going to learn how to write our basic code; “Hello World!”. For this you need only Python Shell. If you have installed python correctly; the following Shell should open up.

Untitled

In python braces/ brackets are not used. they are replaced by indentation. Thus making it a space sensitive language. But i reckon its better than keeping a track of the opening and closing of parenthesis; as u can visualize spacing.

To print a statement in python we make use of the ‘ print ‘ statement.

Untitled

In the above figure the  3 arrow like mark (>>>)  show the indentation of 3 spaces.  Next line shows the use of the print statement. In “Python 2” the print statement was use without the parenthesis. But in “Python 3” the syntax included the use of parenthesis. Hence the first line in the above image shows a Syntax error.

The correct way to  print “Hello world!” is as follows.

 

Congratulations!!! You have  just now written your first Python program.

Next: We will learn about Variables in Python.

 

[fblike showfaces=”false” width=”450″ verb=”like” font=”arial”] [fbshare type=”button_count” float=”none”]Share This[/fbshare] [twitter_follow username=”slidenerdtech” text_color=”#CC0033″ link_color=”#000000″] [google_plusone size=”tall”]