Getting Started with Python
To get started with python, we need to download python from the official website. Python is a cross-platform language meaning it can run on Windows, Linux and Mac OS.
Contents
How to download Python?
You can visit https://www.python.org/downloads to download the latest version which is 3.7.2 as of today’s date.
For Windows and MAC OS users, you can get the list of downloadable files as below:-
For Linux users,
If you are using Ubuntu 16.10 or newer, then you can easily install Python 3.6 with the following commands:
sudo apt-get update sudo apt-get install python3.6
If you’re using another version of Ubuntu (e.g. the latest LTS release), we recommend using the deadsnakes PPA to install Python 3.6:
sudo apt-get install software-properties-common sudo add-apt-repository ppa:deadsnakes/ppa sudo apt-get update sudo apt-get install python3.6
After installing Python, go to terminal and check py entering python for default python or you can use python3 for python 3 if you have 2 separate installations.
python --version
OR
python3 --version
What are the various ways to work with Python?
So to work with Python, we have two modes
- Interactive mode
Typing python in the command line will start the interpreter in immediate mode. Here, we can type Python directly and press enter to get the output. - Scripting mode
The second way of working with Python is by creating a file with the extension “.py”. Once you create the file, you can then execute the file by typing in python <filename> in the terminal.
What are the best Python IDEs and Code Editors?
To ease working with Python programming, you can use different code editors available. An IDE (Integrated Development Environment) allows you to write code effectively as well as provide you with code completion so that you do not have to remember everything .Following are some of the code editors and IDE:-
- IDLE
This comes as a default editor for Python along with the installation. It is available for free. Get more information about IDLE here - Atom
Atom is a free editor developed by Github team. You can download and get started quickly from here - Sublime Text 3
You can use Sublime editor to work with Python. Sublime supports Python along with other many languages. It is available as freemium. Download Sublime Text here - PyCharm
PyCharm is the most popular IDE for Python as it comes with loads of features.
There are two versions of PyCharm available:Community – free open-source version, lightweight, good for Python and scientific development
Professional – paid version, full-featured IDE with support for Web development as well
You can download Pycharm from here - Visual Studio Code
Microsoft has provided this editor with support for Python development. It is a free tool that can be downloaded from here - Spyder
Spyder is an open-source IDE usually used for scientific development. It comes bundled with Anaconda distribution. Anaconda is a popular distribution for data science and machine learning. The Anaconda distribution includes hundreds of packages including NumPy, Pandas, scikit-learn, matplotlib and so on. Go to Spyder official website to get to know more about it.
- IDLE
Once you choose the IDE as per your ease of use, we can get started with the Python programming tutorial.
You can check out Hello World example to get started.