Python is a free, open source, cross-platform programming language that runs on multiple platforms like Windows, Linux and MacOS. If you are a beginner to Python programming, then begin with this article and continue with the flow.
In this tutorial, you will learn the Python basics which will include installation and execution of Python on your computer by writing our first Python program.
This is first part of the Python Tutorial series for absolute beginners.
What is Python programming language?
Python is a free, open source programming language that is easy to learn, highly readable and simple to use. Guido Van Rossum, a Dutch programmer, wrote the Python language in late 1980's as a hobby. Since then, it grown high to become one of the most popular and polished programming language.
As Python is a cross-platform and interpreted language, you can write and build Python applications in Windows, Linux, MacOS and generate the same output on execution.
Python has a simple, clean and elegant English-like syntax. Hence, you can write less code and focus on the core business logic.
How to install Python on Windows 10?
Though you can install Python on Windows, Linux and MacOS, but in this post we are going to discuss installing Python on Windows platform. Follow the below mentioned steps to install Python:
- Download the latest version of Python from the official Python for Windows page.
- Run the installer and select Install for all users option.
- From the Optional Features page, select tcl/tk and IDLE to install the integrated development environment (IDE) for Windows.
- From the Advanced Options page, check the Add Python to environment variables to allow it run from any command prompt.
- Follow the on-screen instructions and complete the installation.
- To confirm the installation of Python, open a command prompt (Console window) and type python to invoke the interpreter in the immediate mode.
- Type 3 + 5 and hit Enter. This should return 8 as the output.
- To come out from the Python immediate mode, type quit() or press CTRL + Z and then hit the Enter key.
How to write our first Python program?
As we have already installed Python on our development environment on Windows 10, we can now start writing our first Python app and execute it from the console as well as from the Python IDE. Let's begin with a simple program that prints "Hello Python" in the output screen.
Open any text editor or the Python IDE from the Start screen. Then type the following code and save it as "hellopython.py
":
print ("Hello Python")
If you are using simple text editor, open any Console window, navigate to the source folder where you saved the hellopython.py file and enter the following command:
python hellopython.py
If you are using the Python IDE, just run the file. You will see the "Hello Python" string printed on the screen.