No history yet

Python Basics

Meet Python

Python is a powerful and versatile programming language. It's known for having a simple, clean syntax that reads a bit like plain English. This readability makes it one of the easiest languages for beginners to learn.

Lesson image

The language was created in the late 1980s by Guido van Rossum. He wanted to design a language that was easy to read and emphasized code readability. He also built it with a "batteries included" philosophy, meaning it comes with a large standard library that provides tools for many common tasks right out of the box.

Because of its simplicity and power, Python is used everywhere: for web development, data analysis, artificial intelligence, scientific computing, and simple scripting to automate everyday tasks.

Lesson image

Getting Set Up

Before you can write any Python code, you need to install it on your computer. The official place to get it is the Python website, python.org. You'll find installers for Windows, macOS, and Linux.

Download the latest stable version. The installation process is straightforward, but make sure to check the box that says "Add Python to PATH" during the Windows installation. This small step will make it much easier to run Python from your command line.

Lesson image

Once installed, Python comes with a simple built-in development environment called IDLE (Integrated Development and Learning Environment). It's a great place to start writing your first lines of code.

Your First Program

It's a tradition for programmers to write a "Hello, World!" program when learning a new language. This simple program just prints the text "Hello, World!" to the screen. It's a quick way to confirm that your setup is working correctly and to see the basic syntax of the language.

In Python, it only takes one line of code.

print("Hello, World!")

Let's break that down.

print() is a function. A function is a named block of code that performs a specific task. The print() function's job is to display output to the screen.

The text inside the parentheses, "Hello, World!", is called an argument. It's the information we give to the function. In this case, we're telling the print() function exactly what text we want it to display. The quotation marks tell Python that this is a string of text, not a command to be executed.

Open IDLE, type that line of code, and press Enter. You should see Hello, World! printed on the next line. Congratulations, you've just run your first Python program!

Now that you have the basics down, let's test your knowledge.

Quiz Questions 1/6

Who is the creator of the Python programming language?

Quiz Questions 2/6

What was a primary goal behind Python's design?

With setup complete and your first program written, you're ready to explore what else Python can do.