How to run Python Program?
1. Write the Python Code
Create a file for your program using a Python file. Here’s how you can do it:
- Open a text editor or an Integrated Development Environment (IDE) like VS Code, PyCharm, or IDLE (default with Python).
- Write the following code in the editor:
print("Welcome To Jobbinge")
2. Save the Python File
Save the file with the .py
extension. This extension indicates it’s a Python script.
- Example: Save the file as
welcome.py
.
š Ensure you save it in a directory where you can easily access it later.
3. Install Python (If Not Installed)
If you haven’t installed Python yet:
- Download Python from python.org.
- Install it according to the installation instructions.
- During installation, be sure to check the option “Add Python to PATH”.
š To verify installation, open a terminal or command prompt and type:
python --version
or
python3 --version
You should see the installed Python version.
4. Open Terminal or Command Prompt
- On Windows: Press
Win + R
, typecmd
, and hit Enter. - On Mac/Linux: Open the Terminal from the applications menu.
Use the cd
(change directory), command and navigate to the directory holding your Python file:
cd path_to_your_file_directory
For example, if your file is in the Documents
folder:
cd Documents
5. Run the Python Program
Once you are in the directory, execute the Python script by typing:
python welcome.py
or, if python3
is the command for Python on your system:
python3 welcome.py
6. See the Output
After running the command, you should see the following output in your terminal:
Welcome To Jobbinge
Additional notes
- If you are using an IDE such as PyCharm or VS Code, you can run the program from the IDE by clicking the “Run” button.
- You can run the program by pressing
F5
after writing your code in Python IDLE.