-
Notifications
You must be signed in to change notification settings - Fork 0
Setting Up Python and Writing Your First Code
Shaswat Raj edited this page Dec 17, 2024
·
1 revision
Welcome to Section 2 of Python One Shot for Beginners 2025! This guide will help you set up Python on your system and write your very first Python program.
Python is easy to install on any operating system. For 2025, make sure you’re using Python 3.12 or higher for maximum compatibility.
- Go to the [official Python website](https://www.python.org).
- Download the latest Python installer for Windows.
- Important: During installation, check the box that says “Add Python to PATH”.
- Verify the installation by opening Command Prompt and typing:
If installed correctly, it will show the Python version.
python --version
- Open Terminal and check if Python is pre-installed:
python3 --version
- If not installed, use Homebrew (a package manager) to install it:
brew install python
- Verify with:
python3 --version
- Open your terminal and check for Python:
python3 --version
- If it’s not there, use the package manager to install Python:
- For Debian/Ubuntu:
sudo apt update sudo apt install python3
- For Debian/Ubuntu:
- Verify installation.
To write and run Python code efficiently, you need a good code editor. We recommend Visual Studio Code (VS Code).
- Download VS Code from [code.visualstudio.com](https://code.visualstudio.com).
- Open VS Code and go to the Extensions Marketplace (on the left sidebar).
- Install the Python extension.
- Once done, you can write Python code, run it, and see results directly within VS Code!
- IDLE: Comes built-in with Python.
- Replit: Online editor, no installation required. Perfect for beginners.
Let’s write your very first program! 🎉
- Open your editor (VS Code, IDLE, or Replit).
- Create a new file and save it as
hello.py
. - Write this simple code:
print("Hello, World!")
-
print()
is a built-in Python function that displays text on the screen. -
"Hello, World!"
is a string that we’re printing.
Here’s how you can run the hello.py
program:
- Click the Run button at the top or press
Ctrl + F5
. - You’ll see this output in the terminal:
Hello, World!
- Navigate to the folder where
hello.py
is saved. - Run this command:
Or on some systems:
python hello.py
python3 hello.py
- The output will be:
Hello, World!
You’ve just written and executed your first Python program! This confirms that:
- Python is successfully installed.
- Your code editor is working correctly.
- You’ve taken the first step into coding!
In this section, you:
- Installed the latest version of Python.
- Set up a code editor (VS Code or alternatives).
- Wrote and ran your first program using Python.
Next up: Python Fundamentals → Variables, Data Types, and more! 🎯
🔗 Quick Links:
- Python Download: [python.org](https://www.python.org)
- Visual Studio Code: [code.visualstudio.com](https://code.visualstudio.com)
- Online Editor: [Replit](https://replit.com)
© TechShade | 2025