In previous article we had discussed about Python Installation. Now in this article we will learn how to create first python project by using PyCharm.
We will also discuss the python basic syntax which we will use for creating our first python project.
Steps to create first python project:
Below are the simple steps to create our first python project.
Step 1 First we have to open PyCharm editor. Then we can see the below screen of PyCharm. Now we can create a new project by clicking on File > New Project… (As highlighted in the screenshot).
Step 2 Now we have to select a location path where we keep the project.
By default, PyCharm found the base interpreter for Python which we had installed earlier.
Step 3 By default, it’s crated as “untitled” but we have to give some meaningful name like “MyPythonProject”. Please see below screenshot, we have changed the path as well as the name of the project.
Step 4 Now it’s time to create a Python file to write code and run first Python project. To create a Python file, right click on the Project name > New > Python File (as highlighted in below screenshot).
Step 5 Now pop up screen will appear. Give the appropriate file name as “MyFirstProgram” and click on “ok” button.
Step 6 Now write a first Python program by using “Print” function.
Ex. print(“My First Python Program.”)
Step 7 Now execute the written Python code. Go to the “Run” menu and select first option Run ‘MyFirstProgram’ to run our program.
Step 8 We can also run the code by using given highlighted steps. Right click on the MyFirstProgram.py file (the name, given while creating Python file) click on Run ‘MyFirstProgram’.
Step 9 We can see the output of our first Python program (MyFirstProgram.py) at the bottom of the screen.
In a nutshell:
- “.PY” is a Python file extension.
- “print () ” is a Python built-in Function.