This web content provides a step-by-step guide for beginners to run their first Python program using the PyCharm IDE, including setting up a new project and writing a "Hello World" program.
Abstract
The article "Run the First Program in Python: Python Complete Course — Part 7" is designed for individuals who have Python and the PyCharm IDE installed on their computers. It outlines the process of creating a new project in PyCharm, selecting a directory for project files, and writing and executing a simple "Hello World" Python script. The guide is complemented by screenshots for visual assistance and concludes with a summary of the learned skills, which include creating a Python file and using the print() function to display messages on the console. Additionally, the author encourages readers to subscribe for future posts and consider a Medium membership to support the writer and access unlimited stories.
Opinions
The author assumes the reader has already installed Python and PyCharm IDE, indicating a target audience of beginners who are past the initial setup phase.
The use of figures and screenshots is emphasized as a valuable tool for guiding readers through the steps visually.
The author expresses gratitude for the reader's time and encourages direct support through Medium subscriptions, suggesting a personal investment in the reader's learning journey.
The article is part of a larger series, the "Python Complete Beginner to Expert Course," implying a structured and comprehensive approach to learning Python.
A cost-effective AI service recommendation indicates the author's interest in providing readers with valuable resources beyond the scope of the article.
Run the First Program in Python: Python Complete Course — Part 7
When you open PyCharm for the first time, you will get a window like this through which you will create a new PyCharm project to start coding.
PyCharm Window (Screenshot By Author).
To create your first project:
1. Go to File and select a New Project. Refer to Figure1.
Figure1: Create New Project (Screenshot By Author).
2. Select the directory in which you want to save the project files. For example Desktop — python course, click ok and then create. Refer to Figure 2.
Figure 2: Choose the location to save your project files (Screenshot By Author).
3. After that you can choose This Window if you want to open your project on your current window or choose New Window if you want to open it in another PyCharm window. For now, let us choose the This Window option. Refer to Figure 3.
Figure 3: The Open Project Options (Screenshot By Author).
You should wait a little bit until your project is created.
4. Once it is created, you will find your project files and the virtual environment (which will be clearer in the future) for that project in the left corner area. Refer to Figure 4.
Figure 4: The Virtual Environment of the project files (Screenshot By Author).
5. Now let us create a Python file to start coding. Right-click on the “python course” project, and choose New then Python file. Refer to Figure 5.
Figure 5: Create a Python File (Screenshot By Author).
6. Finally, give your file a name. For example temp.py, then enter. You will see that a new file will be opened and this file will be empty. Refer to Figure 6.
Figure 6: temp.py Python File (Screenshot By Author).
To display the message “Hello World”, you must use the function “print”.
print() is a built-in function in Python, and you can use it to display a message on the screen.
Input:
print('Hello World')
To run this code and get the output, press right-click, then select Run ‘temp’, Or use the green triangle in the upper right corner. Refer to Figure 7.
Figure 7: Run Icon (Screenshot By Author).
Output:
Hello World
If you follow these steps without any problem, this means that you correctly installed Python and PyCharm IDE.
Congratulations!
You are ready now to start your journey with your Python programming language.
Now, let us summarize what we have learned in this article:
How to write your first program in Python to print “Hello World”.
P.S.: A million thanks for your time reading my story. Before you leave let me mention quickly two points:
First, to get my posts in your inbox directly, would you please subscribe here, and you can follow me here.
Second, writers made thousands of $$ on Medium. To get unlimited access to Medium stories and start earning, sign up now for Medium membershipwhichonly costs $5 per month. By signing up with this link, you can directly support me at no extra cost to you.