After installing Python and PyCharm in your Computer, run the PyCharm and create a new Python Project. Follow the steps:
- Click on file menu
- Click on “New Project”
- Give a project name, we named our project our-first-project
- Now we will write our first python program which will print “Hello World!” to the console.
Right click on the project name (our-first-project) then “New” and finally select “Python File” like mentioned in the bellow:
- Now give a name for the Python file, in our case it is “HelloWorld”
It will be saved as HelloWorld.py in the computer.
- Now let’s write our code to print “Hello World!” in the console. Click on the HelloWorld.py file from the left-side project panel if it is not already opened in the right-side panel. Then write
print(“Hello World!”); or print(“Hello World!”)
- We have written our code to print Hello World! in the console. Now it’s time to run our code. Right click on the python file from the left-side project panel or right click on the code from the right side and then select Run HelloWorld. We will seeoutput in the console.
- Now if we do not see any error in the console, you have successfully run the code and produced output Hello World!