Python IDE – How to set up Python editor to start writing programs
Downloading Python from official website
In order to be able to learn and run Python programs at your computer you need to download stable version of Python and configure it (if required). The current stable versions are Python 2.7.6 and Python 3.3.3.
For learning purpose we recommend downloading latest version. However if you need to learn and then work at a previously developed project then maybe you need previous version.
The downloadable versions are available at following link: http://www.python.org/download/
Installing Python at Windows computer
Follow these steps to install Python:
- Download appropriate version from link given above for Windows. The windows installer is Pythonxx.msi.
- After downloading double click on .msi file and run the setup.
- Just follow the steps.
Running code on Shell window
Lets us say, If you are using Windows 7 and installed Python 3.3.2 then go to Start –> All Programs –> Python 3.3 and open IDLE(Python 3.3)
After shell window is opened (IDLE) write these statements:
print ("hello World")
That should output as:
Here you go, Python is installed.
Please note print has become function in Python 3.3. Before that it was taken as statement. So this will generate an error:
Print “hello world”
There you may write any commands, statements, loops etc using Python syntax.
Similarly you can use menu File – New Window in shell window: This will open a new window where you can write full code of Python. Save it to desired location and give it a name. To parse/run code press F5 or go through menu.
Setting up Python on MAC OS
In MAC OS Python is bundled, i.e. Mac OS already has it. However this is quite probable that the version is quite old. In order to use latest version go to download page of official website: http://www.python.org/download/. Download appropriate version for MAC and install it into your system.
How to start IDLE on MAC
In a terminal window, type python. The Python shell should be started.
In prompt (>>>) of shell window type: import idlelib.idle
This should start Python’s IDLE IDE.
- Python Hello World example
- A Python programming tutorial for beginners and advanced learning
- Quickly learn Python strings with 3 examples
- Understand using Python Open, Read, Write methods with 2 Demos
- How to define and call Python function with return examples
- Python Input VS Raw_input – Learn to Take User input with 2 Demos
- Python data types – Int, Float, string, dict, lists with examples
- Python exception: try except with 3 examples to handle errors