-
Hajipur, Bihar, 844101
Before installing Python, check whether it is already installed on your system.
Open Command Prompt and type:
python --version
If installed, you will see something like:
Python 3.11.2
If not installed, it may show an error like 'python' is not recognized as an internal or external command
.
Open the Terminal and type the same command:
python3 --version
If Python 3 is installed, it will show the version.
Visit the official Python download page:
👉 https://www.python.org/downloads/
The site will automatically detect your operating system.
Click the Download Python 3.x.x button.
Run the downloaded .exe
file.
IMPORTANT: ✅ Check the box that says "Add Python to PATH" (This allows you to use Python from any folder).
Click "Install Now".
Wait for the setup to complete.
Click "Close" once done.
To verify, open Command Prompt and run:
python --version
Download the .pkg
installer from the official website.
Open it and follow the default installation steps.
After installation, open Terminal and type:
python3 --version
If you see a version like Python 3.12.0
, it’s installed correctly.
Most Linux distributions come with Python pre-installed. But to install the latest version:
sudo apt update
sudo apt install python3
Check the installation:
python3 --version
After installing Python, you also get pip (Python’s package manager).
Check Python:
python --version # or python3 --version
Check pip:
pip --version # or pip3 --version
Output should be like:
pip 23.0.1 from ... (python 3.11)
Now let's test Python by writing a simple program.
python
Then type:
print("Hello, Python!")
Output:
Hello, Python!
To exit, type:
exit()
Create a file named hello.py
with the following code:
print("Hello from a Python file!")
Run it:
python hello.py
If python
doesn’t work, try python3
.
Make sure “Add Python to PATH” was checked during Windows installation.
Use where python
(Windows) or which python3
(macOS/Linux) to locate Python.
Platform | Command to Run Python | Check Version |
---|---|---|
Windows | python |
python --version |
macOS | python3 |
python3 --version |
Linux | python3 |
python3 --version |
Q1. Print your name:
Expected: My name is CodePractice
Q2. Add two numbers and display:
Output: Sum: 15
Q3. Display installation success message:
Output: Python installed successfully!
Q4. Show today’s date using datetime
:
Output: Today’s date is: YYYY‑MM‑DD
Q5. Print three lines:
Welcome to Python
# Let's start coding
# Happy Learning!
Q1: Python file extension:
Q2: Which command is used to check the Python version installed?
Q3: What will be the output of the statement print("Hello")?
Q4: What is the official website to download Python?
Q5: Which tool is commonly used to write Python code?