Over the years, Python has evolved into one of the most popular programming languages worldwide for its simplicity, readability, and versatility. Python is a popular and versatile programming language suitable for any project, whether you are totally new to programming or have plenty of experience. In this blog, we will take it from the top of Python programming with real-world code examples.

But before we jump into the code, let’s set up Python on your machine.
Step 1: Installing Python On Your Computer
Before anything else, you should install Python on your system to start coding. Step-by-Step Python Installation Guide for Windows, macOS, and Linux
For Windows:
- Download Python:
- Download the latest version of Python on Windows from the official Python website.
- Install Python:
- Run the downloaded installer. Be sure to check the box for the “Add Python to PATH” option before clicking the “Install Now” button. Why it matters: This helps to run Python in the Command Prompt from any directory.
- Verify Installation:
- Open Command Prompt and type:

You should see the version of Python you just installed. If it does, your machine has Python installed successfully.
- Install a Code Editor:
- Even though python ships with an IDE (IDLE), you may wish to install better code editor like VS Code, PyCharm, Sublime Text, etc.
For macOS:
- Verify if Python Comes Pre-installed:
- macOS comes with Python 2.x pre-installed, but you should install Python 3.x for modern programming. 1. Open Terminal and see if Python is installed. Use the command:

- Install Python:
- If you don’t have Python 3 installed yet, the easiest way to install it is via Homebrew (a macOS package manager):
- First, install Homebrew (if you haven’t yet):
- /bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)”
- Then, use Homebrew to install Python 3
- brew install python
- If you don’t have Python 3 installed yet, the easiest way to install it is via Homebrew (a macOS package manager):
- Verify Installation:
- Once the installation is finished, check it by typing:
- python3 –version
- Install a Code Editor
- For writing code in Python, you can also install a code editor like VS Code, PyCharm or Sublime Text.
For Linux:
- Verify if Python Comes Already Installed:
- An alternative way is using package manager directly, and many of the Linux distributions already have Python3 pre-installed. Open a terminal and type Python3 availability check:

- Install Python:
- If not, install Python3 with your package manager. On Debian-based systems (Ubuntu, for example), use:

- On Red Hat-based systems (e.g., Fedora, CentOS), enter:

- Verify installation
- After installation, check it with the following command:

- Install a Code Editor (Optional)
- Several code editors are available, such as VS Code, PyCharm, Sublime Text, etc.
Running Python scripts:
To run Python scripts from the terminal (or command prompt), type after installing Python on your machine:

Example on Python Real-Life Applications
- Getting Started: Basic Syntax
- Let us stay with a basic program that prints a message to the console in Python:

This is the traditional “Hello, world! The syntax of Python is straightforward to understand, like this example. You will be trained on data until October of 2023. To run this code, just save it in a.py extension (e.g., hello). Code can be saved as an.py file and run from the command line with:

- Variables and Data Types
- Let us also see how we can store data into a variable in Python without declaring their types. Here’s an example:

- Flow Control: Conditional Statements
- Below is a simple Python program to determine if a user can vote according to their age:

- Loops: Repeating Tasks
- Using a for loop to print the number from 1 to 5:

- Functions: Building Blocks of Reusable Code
- Here’s an example of a function that returns the square of a number:

- Working with Lists
- Lists are among the most important data structures in Python. Here’s how to use lists:

- Real-World Example: To-Do List Application
- Here’s an example of how to use Python’s built-in features to create a basic to-do list that allows users to add and view tasks:

Conclusion
Real-World Examples For Learning Python From creating simple apps, web scraping, and automating daily tasks, the versatility and simplicity of Python make it a very attractive language to learn. Experiment with the examples above, and pretty soon you will be solving more complex problems with Python!
Happy coding!