/  Technology   /  How to Code in Python using PyCharm
How to Code in Python using PyCharm 5 (i2tutorials)

How to Code in Python using PyCharm

Python is a very famous and easy language to learn. It is famous for its simple programming syntax, code readability, and English like commands. Also, Python is the most popular language used by data scientists around the world. There are many features because of which it is popular among the developer’s community, as well as in industries. So to use all the features of python effectively we need IDE.


What is an IDE?

An integrated development environment is a software that helps you write the code. IDE makes developing applications, programs easier. It acts as a text editor, debugger, and compiler. It contains all the tools and features required by a programmer. Hence, it is easier to develop any application or program using an IDE.        

In this article we will learn how to code in python using PyCharm.   


PyCharm

PyCharm is an IDE created by Czech company JetBrains, used in computer programming languages, especially for the Python programming language. PyCharm is also one of the most widely used IDEs for python programming language. PyCharm is compatible with Windows, Linux, and MacOS.


Installation

You can directly install PyCharm from the official website of JetBrains.


After opening the link you will see something like this

How to Code in Python using PyCharm 1 (i2tutorials)


There will be two versions of PyCharm. One will be a community version and the other one will be a professional version. You need to download the community version because it is free.

The professional version will get expire after 30 days, that’s why it is suggested to download and install the community version only.

Once after you complete the installation process and open PyCharm this will be the first page that PyCharm will open.

How to Code in Python using PyCharm 2 (i2tutorials)


As we are installing PyCharm for the very first time we will only see the three options. Otherwise on the left side which is currently blank, you will see all the codes that you recently opened or worked with.

So, let’s start by creating a new project. When you click on create a new project, you will get New Project Popup, asking for the project location, choosing the environment.

You can specify the environment location, choose the base interpreter from the list. But it is recommended to go with defaults and directly create by clicking on the create on the bottom right. Leaving the inherit global site-packages and make it available to all project checkboxes unselected.


Writing Code

Now it’s time to start a new python program. For that you can go to File and click New Scratch File and choose Python file.

How to Code in Python using PyCharm 3 (i2tutorials)

Then a new python file will be created by the name scratch.py


For example:

we will start with a program of the addition of two numbers.

A = int(input(‘Input first no’))
B = int(input(‘Input second no’))

print(A+B)


Running Code

There are a few ways in which you can run this program. Click on the green arrow on to the left or Right-click in the background and choose Run ‘scratch’ or you can use ctrl + shift + F10.


Debugging

You can debug the program by clicking on the bug icon present in the left or just Right-click in the background and click Debug ‘scratch’. You can place the debugger wherever you want and can stop the execution of the program at this particular point in time.


Installing Packages

Every package or library will not come inbuilt; some we need to install externally. For that go to File, then Setting. Then click on Project interpreter. To add a new library click on the Plus icon on the top right side and search the library you required, install it.

How to Code in Python using PyCharm 4 (i2tutorials)


I hope this article will help you for getting started with python language using PyCharm IDE.

Leave a comment