Run a Python Script


You can run your Python code in a number of ways. From the menu bar at the top of PyCharm, click on Run. From the menu that appears, select Run:

The Run menu  in PyCharm

You can also run a script by right-clicking inside the white coding area. From the menu that appears, select Run YOUR_PYTHON_FILE_NAME:

The right-click run menu

Once you run your code for the first time, you'll see a green Play button appear in the top right of the PyCharm IDE:

The Run icon

Click on HelloPython and select Save HelloPython Configuration:

setting a Python run configuartion

You don't have to do this, but it makes it easier to run your files in future because you can just click the green play button instead of using the menus.

What you should have notices is a new area appear at the bottom pf your screen showing the result of running your code:

The output window showing the results of a Python script

You can pretty much ignore the first two lines, in the image above (yours might be on one line). The third line, where it says Hello World, is the output of your code. The final line just tells you that there are no errors.

Notice that there's another green play button, to the left of the new area in the bottom of the IDE. You can click this to run your script again.

Congratulations - you are now up and running with Python! In the next lesson, you'll learn how to set up and use variables.

Python Number Variables >