Practical – 147 : Use Command Line and IDE to create and execute a python program
Here’s a simple step-by-step guide to create and execute a Python program using both Command Line and IDE (like VS Code or IDLE):
✅ 1. Using Command Line (Terminal / CMD)
🔹 Step 1: Open Command Line
- Windows: Press Win + R, type cmd, and hit Enter.
- Linux/macOS: Open Terminal.
🔹 Step 2: Create a Python File
You can use Notepad or any basic text editor.
- Open Notepad.
- Write the following code:
- print(“Hello from Python using Command Line!”)
- Save the file as: hello.py (e.g., on Desktop or any folder)
🔹 Step 3: Run the Program
- Open CMD and navigate to the folder:
- cd Desktop
- Run the file:
- python hello.py
✅ Output:
Hello from Python using Command Line!
✅ 2. Using an IDE (VS Code or IDLE)
🔹 Option 1: Using IDLE (comes with Python)
- Open IDLE (Search “IDLE” in Start Menu)
- Click File → New File
- Type:
- print(“Hello from Python using IDLE!”)
- Save as hello.py
- Click Run → Run Module or press F5
✅ Output will appear in the shell.
🔹 Option 2: Using VS Code
- Open Visual Studio Code
- Install the Python Extension (if not already)
- Create a new file: hello.py
- Type:
- print(“Hello from Python using VS Code!”)
- Save the file
- Right-click and select Run Python File in Terminal
✅ Output:
Hello from Python using VS Code!