No history yet

Introduction to Python

What is Python?

Python is a programming language known for its readability. It was created in the late 1980s by Guido van Rossum, who wanted a language that was easy to read and write. The core idea is that code should be clear and expressive, almost like reading plain English. This makes it a great choice for beginners.

But it's not just for newcomers. Python is also incredibly powerful and versatile. Major companies like Google, Netflix, and Instagram use it for everything from web servers to data analysis. Its massive collection of libraries—pre-written code you can use—means you can build complex applications without starting from scratch.

Lesson image

You can find Python powering web applications, scientific research, artificial intelligence, and system automation. Its flexibility is one of its biggest strengths.

Getting Started

Before you can write any code, you need to install Python on your computer. You can download the official installer from python.org. There are different versions available, but it’s always best to grab the latest stable release.

The installation process is straightforward. Just run the installer and follow the on-screen instructions. Make sure to check the box that says "Add Python to PATH" during installation on Windows. This small step makes it easier to run Python from your computer's command line.

Lesson image

Next, you'll need a place to write your code. While you could use a simple text editor, most developers use an Integrated Development Environment, or IDE. An IDE is a software application that combines a code editor, a debugger (for finding errors), and other helpful tools into one package.

Good IDEs make coding much smoother. They offer features like syntax highlighting, which colors your code to make it easier to read, and code completion, which suggests code as you type. Popular choices for Python include Visual Studio Code (VS Code) and PyCharm. You can't go wrong with either one.

Your First Program

It's a tradition in programming to start by making the computer say "Hello, World!". This simple task confirms that your setup is working correctly and gives you a first taste of the language's syntax.

Open your IDE, create a new file, and save it as hello.py. The .py extension is important—it tells the computer that this is a Python file. Now, type the following line of code into your file.

print("Hello, World!")

Let's break that down. print() is a built-in Python function that displays text on the screen. The text you want to display goes inside the parentheses. We put it in quotation marks to tell Python that it's a string—a sequence of characters.

To run your program, you can either use the run button in your IDE (often a green triangle) or open a terminal, navigate to the folder where you saved your file, and type python hello.py. If everything is set up correctly, you'll see "Hello, World!" printed out.

Lesson image

Congratulations, you've just written and executed your first Python program! This is the first step on your journey to becoming a programmer.