No history yet

Introduction to Python

Meet Python

Python is a programming language known for its simplicity and readability. It was created in the late 1980s by Guido van Rossum, who wanted a language that was easy to read and write, almost like plain English. This focus on clarity is one of Python's biggest strengths.

Lesson image

Because it's so approachable, Python is often the first language people learn. But it's also incredibly powerful. Professionals use it for everything from building websites and automating repetitive tasks to conducting complex data analysis and developing artificial intelligence. This versatility, combined with a huge and supportive community, makes Python one of the most popular programming languages in the world.

Setting Up Your Workspace

To start writing Python, you need two things: the Python interpreter and a place to write your code. The interpreter is what reads your Python code and translates it into instructions the computer can understand. You can download it for free from the official Python website, python.org.

Make sure to check the box that says "Add Python to PATH" during installation. This makes it easier to run your code from anywhere on your computer.

Next, you need a code editor. While you could use a basic text editor, most developers use an Integrated Development Environment, or IDE. Think of an IDE as a supercharged text editor designed specifically for programming. It includes helpful features like syntax highlighting, which colors your code to make it more readable, and tools for running and debugging your programs.

Lesson image

Two of the most popular IDEs for Python are Visual Studio Code (VS Code) and PyCharm. Both are excellent choices for beginners. For now, just pick one and install it. You don't need to worry about advanced configurations; the default settings will work perfectly.

Your First Program

It's a tradition in programming to start by writing a program that simply displays "Hello, World!" on the screen. This simple task confirms that your setup is working correctly and gives you your first taste of writing and running code.

Open your IDE and create a new file. Save it as hello.py. The .py extension is important—it tells your computer that this is a Python file.

Now, type the following line of code into your file:

print("Hello, World!")

This line uses Python's built-in print() function. A function is a reusable block of code that performs a specific action. The print() function's action is to display whatever you put inside its parentheses on the screen.

After typing the code, save the file. Most IDEs have a "Run" button (often a green triangle) that will execute your script. When you run it, a terminal or output window will appear, and you should see the following text:

Hello, World!

Congratulations! You've just written and executed your first Python program.

Ready to check your understanding?

Quiz Questions 1/5

Who is the original creator of the Python programming language?

Quiz Questions 2/5

What is the primary role of the Python interpreter?