How to print Hello World! using Python


First download Python on your computer and install it using Windows Installer.

I am using Python 2.7.2 Windows Installer (Windows binary — does not include source) for this code.

After installing Python go to Start>All Programs>Python 2.7>IDLE(Python GUI)

You will see a console such as the following one;

On this Shell if you write a code;

print  “Hello World!”

You will see Hello World text on the console output

Another approach for this code is to create a file with an extension such as helloworldPrinter.py

And calling it from the windows console

The content for helloworldPrinter.py

# this is a comment –>  Hello world python program
# Introduction to Python Development
# Hello World Progran
# author – Tuna TORE

print “Hello World!” # regular print statement

# this is a function
def hello():
    print “Hello World! Function”

if __name__ == “__main__”: # main method
    hello()

The output for the program

Download helloworldPrinter.py file

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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