Thursday, October 14, 2010

How To Create Your First Python Program

Posted: 11 Jul 2010 05:00 PM PDT

Wanna learn how to create your first python program , but don’t know where to start. This is beginner, step by step tutorial with images that will help you trough process.

Step 1

Go to python.org , download latest version and install it.

Step 2

Run IDLE (Python GUI)

Step 3

You can run program via python shell or you can run program as python module . py extension.

Step 3.1

Run program via python shell

In Python shell type
Code:
variable = 'Hello World'

and press enter

then type
Code:
print variable

and press enter, output will be Hello World

This is simple example where we store string “Hello World” into variable and then print it out.

Step 3.2

Run as python script . py

Open notepad and type your code

variable = 'Hello World'
print variable

save as HelloWorld.py

Open IDLE and go to File -> Open and open file with .py extension

After this will appear windows where you’ll able to run module, just press F5 or go to Run -> Run Module

No comments:

Post a Comment