Python Hello World Program – Create & Run Your First Python Program in PyCharm

Free Python courses with 57 real-time projects - Learn Python

Python Hello World Program – Your first step towards Python world.

When we learn any programming language, hello world is our first program. We run this simple program to verify our development as well as deployment environment.

In this tutorial, we’ll learn how to create the first python program ie hello world in PyCharm. Before building our very first python project PyCharm, let’s first get a little background check on PyCharm.

PyCharm is yet another Integrated development environment (IDE) available for Python. Well, it’s one of the most popular IDEs and is in the good books of many Python programmers.

You don’t really need to ponder on which IDE to choose if you’re a complete Python newbie. The choice of IDE becomes important when your projects become larger and complex. This is where the extra tools and features of PyCharm prove to be effective.

Check out the latest Python Tutorial Series with 270+ Tutorials, Practicals, Projects, and many more!!

What is PyCharm?

Developed by JetBrains, PyCharm is a Python IDE for Professional Python Developers. PyCharm comes with tons of different features and tools for writing complex codes. To name a few, Pycharm provides a smart code editor. This comes with code inspections, error highlighting, and debugging tools. It also offers framework support for web development. It is a cross-technology IDE and supports Python, JavaScript, SQL, HTML/CSS, Node.js, and more.

Enough praises! Let’s install PyCharm!!

PyCharm Installation

PyCharm is available for Windows, Mac as well as Linux. You can download the latest version from the official JetBrains website. The Community edition is free and open-source. The Professional PyCharm edition is paid but available for free 30-days trial.

After downloading the setup file from the website, run it, and finish the installation process. While launching PyCharm for the first time, it will ask you to choose a dark or light theme.

pycharm select theme

You can skip the installation of other plugins.

Now that our setup is complete, let’s do some coding.

Create a New Python Project – Hello World Application

On the ‘Welcome to PyCharm’ window, you’ll find a ‘Create New Project’ option. Select this option.

pycharm create new project

Next, choose an appropriate name for your first project. I’ve named it “myFirstProject”. You can now choose the location where you want your project to live on the disk. I’ve left the default path.

create python project

PyCharms recognizes any existing Python installations. You can choose any one of the underlying options as your base interpreter for the project.

Click on the create option at the bottom right corner.

Create a Python File and run it

On the top left side of the Project window, you’ll see the name of your project. Right-click on the name and create a new Python file, in this file we will write the code to print hello world

create python program

To mark the beginning of our first python project in PyCharm, we’ll write our very “original” Hello world program!! It’s a tradition, you can’t escape it!

Choose an appropriate name for your file. I’ve named it “hello.py”.

python hello world file name

Start writing the python program to print “Hello World” in this file.

print("Hello world! - from DataFlair")

Execute Python Hello World Program

To run the file, click on the green play button at the top right side of the UI. Or press CTRL+SHIFT+F10 (or just SHIFT+F10, depending on the version).

execute python hello world program

The top box shows the code to print hello world and the bottom one shows the output for that code.

This Hello world program is really dull, right? Let’s customize it.

name = input()
if name == '':
    print("Hello world! - from DataFlair")
else
    print("Hello " + name + "! - from DataFlair")

customize hello world

Here, we ask a name as input and say hello to the name. If the user doesn’t input any name, we simply print hello world. Let’s run it.

Output when you don’t provide any input:

hello world program output

Output when you give a name as input:

program output

There you go! You have now created a simple yet fully functional PyCharm Project.

Summary

In this tutorial, we created our first python program ie hello world program in PyCharm.

PyCharm, and IDEs in general, tend to shine on larger projects. You’ll see many powerful features of PyCharm at work while writing heavy and complex codes.

There’s a reason why PyCharm is so popular among the Python programmers. With its syntax suggestions, type checking, debugging, etc, PyCharm will make your programming life so much easier.
Working with PyCharm might feel overwhelming at first. But you’ll learn little bits of the IDE as you go. Soon you’ll understand almost the entire IDE and you won’t imagine programming without it.

Did you know we work 24x7 to provide you best tutorials
Please encourage us - write a review on Google

follow dataflair on YouTube

Leave a Reply

Your email address will not be published. Required fields are marked *