A First Python Project

In the previous section, you created a new project. The screen that you'll see whenever you do create a new project in PyCharm is this one:

PyCharm IDE when a new project is created

You now need to create a new python file to go in your project. To do that, you can click File from the menu bars at the top, then New. You'll see this menu:

The menu ro create a new Python project file

Another way to create a new python file is to right-click the project name (MyFirstProject) in the project area on the left. Then select New > Python File from the menu that appears:

Right-click the project name to create a new Python file

Type a name for your Python file. Call it HelloPython, and click OK:

The New Python File dialog box

In the PyCharm IDE, you should see this:

A New Python file showing in the project explorer on the left of PyCharm

Notice that the name of a Python file ends in .py. The big white area to the right is where you'll type all your code.

Click inside this big white area. Now enter the following line of code:

print("Hello World")

As soon as you start typing, PyCharm will try to guess what you want:

The PyCharm context menu showing the Python print command

You can double click the print item in the popup box to have PyCharm complete the code for you. When it does, it will add the round brackets. Type a double quote and it will add a second one for you. (You can also use single quotes, if you prefer.)

In the IDE, it should look like this:

Some hello world text in Python

Or like this, if you used single quotes:

A Python file with the print command

Let's run the code and see what happens. We'll do that in the next lesson below.

Running your Python Scripts >