Previous | Next


You are going to write your first Python program now. Let’s try this by writing a simple “hello” Python script, save it and execute it.

Saving .py file

Type the following using an editor. Save the file as hello.py. Please note that all python script file will use .py as its file extension.

print "Hello, world!"
print "Welcome to askyb!"

Executing .py file

Browse to the directory where you keep the hello.py file. Then you can execute your script with the following command in Windows:

C:\askyb>python hello.py

or Linux/Unix:

$ python hello.py

The hello.py get executed by python interpreter and you should see the following output:

Hello, world!
Welcome to askyb!


Previous | Next