Create and Run Python Project
To create and run a Python program, you must have
installed on your computer. You may also need to install a Python Code editor,
such as Visual Studio Code, to make project development easier. If you haven't already, follow this guide to install them.
Follow the steps below to create and run a Python project:
Open a terminal and create a folder with your
project name using the command as shown in the
- Launch the Visual Studio Code.
Add your project folder to the Visual Studio Code
Create a Python file (A Python file has .py
File > Add Folder to Workspace and add the project folder into the IDE.
Inside the main.py file add the code given below:
After your project is loaded in the Visual
Studio Code Explorer, right-click on the project
folder and from the toolbar select New File and type main.py as your file name.
Next to run the code, right-click on the main.py
file and from the toolbar options select Run Python File in Terminal. In the IDE console, you will see the output as
Note: You can also run a python program from the
command prompt or terminal. Simply go the location
where your Python file is and execute the command as
shown in the example below: