Table of Contents
Introduction
Are you ready to start coding with Python? This tutorial will help you install Python on your computer and run your very first program. Whether you’re a student or an aspiring developer, this is the first step in your Python journey.
What You Need Before You Begin
- A computer with internet access
- Basic knowledge of how to use your operating system
- No programming experience needed!
Step 1: Downloading Python
Go to the Official Website
Visit python.org and click on the “Downloads” section. It will detect your OS and suggest the best version.
Choose the Right Version
Download the latest stable version. For most users, Python 3.x is recommended.
Step 2: Installing Python
Installing on Windows
Open the downloaded file. Make sure to check the box that says “Add Python to PATH” before clicking Install.
Installing on macOS/Linux
Mac users can install Python using the installer. Linux users can use the terminal command sudo apt install python3.
Check the Installation
Open your terminal or command prompt and type:
python --version
You should see something like Python 3.11.1. This means Python is installed correctly.
Step 3: Running Your First Python Program
Using IDLE
Python comes with a simple code editor called IDLE. Open it, type the code below, and press Enter:
print("Hello, world!")
You will see the output: Hello, world!
Using VS Code (Optional)
If you’re using Visual Studio Code, install the Python extension and run the same code in a new file with a .py extension.
Using Terminal
Open a terminal or command prompt, type python, then enter your code.
Common Errors and Fixes
- ‘python’ not recognized: Reinstall and check the PATH option.
- SyntaxError: Make sure your code is typed exactly like the example.
Watch: Installing Python and Running First Program
This video walks through the download, installation, and first code demo for Python.
Practice Challenge
Try editing the program to print your name or a math expression like print(5 + 3).
What’s Next?
Now that you’ve written your first Python program, move on to topics like variables, data types, and functions. Check out our Python for Beginners course.
Frequently Asked Questions
Do I need to install Python separately on every computer? Yes, unless you’re using an online compiler like Replit.
Can I uninstall and reinstall Python? Yes, just make sure to restart your system after reinstalling.
Which version of Python should I use? Always choose the latest Python 3.x version unless told otherwise.
Summary
You’ve just taken the first step in your coding journey. You downloaded Python, installed it, and ran your first line of code. Great job! Keep practicing and explore more with our beginner tutorials.