Python is a high-level, general-purpose programming language. It supports multiple programming
paradigms, including structured, object-oriented and functional programming. It was created by
Guido van Rossum, and released in 1991.
Reasons why the python program is very popular:
Easy to learn - because of its compact and English-like code syntax it is very easy to
learn. Figure 1.1 shows an example of opening a file in java versus python. In java, more
lines of code are required and it's difficult to remember whereas in python it's pretty
compact, with fewer lines of code and is extremely easy to remember.
Libraries - Python has more than 100,000 packages e.g. so let's say if you are working with
images then there is pillow if you are a database programmer there is sql alchemy if you are
doing scientific computing then there is sci-fi there is NumPy, matplotlib the list just
goes on and on top of it.
Code development is faster - you can develop code much faster in python compared to other
compiled languages such as java or c++. This is since:
syntax and APIs are easily remembered.
Python is an interpreted language it doesn't have compilation. It allows one to
focus on the real problem remember which speeds up your development by a great
amount compared to other programming languages.
Huge collection of the library so one can directly use it from the package available.
Python is heavily used in data science and machine learning due to awesome packages such
as sci-kit-learn NumPy sci-fi and pandas.
Job opportunities - there are so many job opportunities available in companies like
Google and Facebook which uses Python heavily. It's used in popular websites such as YouTube
Quora, Survey Monkey, Dropbox etc which are very high-scale systems.
Integrated Development Environment (IDE)
An integrated development environment (IDE) is a software application that provides necessary
tools for computer programmers for software development. It contains both an editor and a
compiler. Some examples of Python IDLE include IDLE, PyCharm, Atom, Notebook, VsCode, Vim etc.
For this guide, we are going to use PyCharm.
You can download PyCharm from the JetBrains website:
https://www.jetbrains.com/pycharm/
Once you click on download, it will give you two options: Professional or
Community. The
professional edition of PyCharm requires a subscription, while the Community
edition is
free. Download the Community edition
After the download is complete, run the file to install PyCharm. Click on
Next on the
Welcome to PyCharm Community Edition Setup window.
The Choose Install Location window allows you the choose a location where
the PyCharm
would
be installed. You can leave it to the default location and just click on
Next. However,
if
you wish to choose another location then use Browse option.
In the Installation Options window, there are a couple of installation
options. You can
select three options and leave out Create Associations. Then click on Next.
Then it will ask you to Choose Start Menu Folder. Keep it to the default
setting and
just
click on Install.
The installation process will begin.
In the last setup window, you can choose to Reboot Now and click on Finish
to complete
the
installation. Your computer will restart. You can choose to start later if
you
wish.
When you open PyCharm for the very first time, it’ll run you through a
couple of dialogue
boxes. First, it’ll ask you if you have read and accepted the policy. Read
through the
entire policy, accept the agreement and click on Continue.
Then it’ll ask you if they can collect data from you. You can choose your
option.
It’ll go ahead and install the community edition of PyCharm.
Click on New Project. If you do not have python installed you'll see the
small note pop up
at the bottom of the dialogue box. However, if you do have python installed
that note won't
pop up.
Click on Create which will download and install Python from Python.org. An
Installation
box will pop up informing us that the Python is installed. It will take a
few minutes and
after that, it will create a virtual environment and then it’ll be
done.
Once successfully installed, the first project opens up and it comes with
example
code.
We can go ahead and run this by simply pressing the green arrow in the top
right-hand corner
of the screen. As soon as we do this a small box pops up at the bottom and
executes the code
which in this case is simply a print of the text “Hi PyCharm”. If you see
this then the
python has been installed in the machine properly.
You can also go to the start menu and you'll see that among the recently
added programs you
have the Python Module, IDLE and the python Manual.
In the Create Project dialogue, specify the project name and its location.
The dialogue may
differ depending on the PyCharm edition. Click on Create.
Some existing code will be shown which you can delete and then type
print(“Hello World”).
To run the program click on the green play button on the top right hand
corner. As soon as
we
do this a small box pops up at the bottom and executes the code which in
this case is simply
a print of the text “Hello World”.