How to Download and Install Python on Windows
In order to writing your first Python program, the first step is to know how to download and install Python on your computer machine.
Python programming language is available for all the three popular operating systems like for Windows, Linux/Unix, and Mac OS. We will discuss one by one the installation of Python on all operating systems.
In this tutorial, we will discuss a step by step guide to download and install the Python language interpreter on Windows. After the installation of the interpreter, we will integrate and set up the Python development environment with Eclipse IDE.
IDLE (short for Integrated Development Environment) is a free application that is a basic text editor designed for beginners. You will get it when you will install Python.
Steps to Install Python on Windows Platform
Before you install the latest version of Python on a Windows PC, find out your computer uses the 32-bit or 64-bit version of windows. To check it, right-click on “Computer” and then click on “Properties”. Now choose “System” if the option appears.
After checking your Windows version, please follows the following steps.
Step 1: Go to the Python website
Type the address (https://www.python.org/) into your web browser to visit to the Python website. Then click on “Downloads” to open the download page.
Step 2: Download Python
Click on the latest version of Python for Windows according to Windows version (32-bit or 64-bit). It should begin with the number 3.
At this time, we will download the latest version, Python 3.10.6 that is the newest major release of the Python programming language, and it contains many new features and optimizations.
Select “executable installer” from the different installer options. The installer file will download automatically.
Step 3: Run the installer
Double-click the installer file, which is downloaded to install Python. A window dialog box will open. Choose “install launcher for all users” and click on the “And Python 3.10 to path” check box. It will set the Python path automatically.
Then click “next” at each prompt, without changing the default settings. Look at the below picture to understand better.
You can also click on the customize installation to pick out the desired location and features. But make sure that “install launcher for the all users” and “Add Python to environment variables” are checked or not.
Step 4: Installation in Process
Installer will start the installation process, which may take several minutes, and the below screenshot will be visible during the installation process.
Step 5: Click on close button
Once Python interpreter installation is finished, click on the Close button to complete the installation on Windows platform.
Step 6: Open IDLE
When the installation process is complete, open the IDLE program by searching for it or going to the Start menu, choosing All Apps, then select “IDLE”. A window like a screenshot below should open up.
We have now successfully installed Python 3.10.6 on Windows platform. You can also verify about successful installation of Python through the command prompt.
For this, search for the command prompt and type “python”. A screenshot like below shows that Python 3.10.6 has successfully installed in your system.
Working with IDLE
IDLE, an integrated development environment (IDE) is a set of tools that makes writing programs effortless. It has built for use with Python.
IDLE is a powerful and efficient platform for writing, exploring, testing, and implementing your programs in Python. It provides an easy graphical user interface with lots of helpful features that make program development more convenient and intuitive.
The most important features of IDLE are as follows:
- Python Shell
- Multiple-window text editor
- Auto-completion
- Smart indent
- Syntax highlighting
- Integrated debugger
IDLE provides two different windows in which we can work. They are: Editor window and Shell window. We use the editor window to write and save Python programs, while we use shell window to run Python code immediately.
The shell window
When you will open IDLE on your computer system, the shell window pops up. It is the best place to get started the coding in Python because you don’t need to make a new file first.
Just type the code or statements directly into the shell window and run it straight away. If any message or “bugs” (errors) are in the code, it will display.
Programmers use the shell window like a notepad, to test out snippets of code before putting them into a bigger program. For example, type the following lines of code snippets into the shell window and press the enter/return key after each one.
>>> print('Python is the best programming language in the real world') Python is the best programming language in the real world >>> >>> 125 + 454 * (10/20) 352.0
The first line of code prints a message and the second line does a simple calculation and print the outcome. In the shell window, the symbols “>>>” means the computer is waiting for a new input or command.
The Python shell allows us to enter one command at a time. When we press ENTER, Python reads, interprets, and gives the output on the shell window. After this, the shell waits for the next input.
The editor window
The shell window does not save our code. When we close it, the code you wrote is gone forever. Therefore, if you are working on an extensive project or game, you should not use shell window.
You should use IDLE’s editor window. It will let you save your code. IDLE’s editor window also contains built-in tools to help you write your programs and troubleshoot any errors or bugs.
How to open editor window in IDLE?
Follow the following steps to open editor window in IDLE. They are:
(a) To open editor window in IDLE, click on the File menu at the top bar and select New File. An empty editor will then open up. You have to use this editor window to write your programs.
(b) After writing your programs, save it (with a .py file extension) at your desired location and then run Python programs using the run option in the menu bar. The result will appear in the shell window.
Colors in the code
IDLE automatically colors the text to highlight different portions of the code. The colors make it cushier to understand the code and are useful when you’re endeavoring to spot mistakes.
(a) Symbols and names: Python uses black to color the most code text.
(b) Built-in commands: Python uses purple to color Python commands such as print().
(c) Errors: IDLE use red to alert you to any errors in the code.
(d) Output: IDLE uses blue color to show the output.
(e) Keywords: Python uses orange to show the special Python keywords such as if and else.
(f) Text in quotation marks: Any text in the quotation marks is called string, and it is in green.
In this tutorial, we have discussed how to download and install Python on Windows platform step by step. I hope that you have successfully downloaded and installed the latest version of Python IDLE program on your computer system.
Thanks for reading!!!