No history yet

Introduction to Python

What Is Python?

Python is a programming language created in the late 1980s by Guido van Rossum. He wanted to build a language that was easy to read and write, emphasizing clarity and simplicity. The name, surprisingly, comes from Monty Python's Flying Circus, not the snake.

Lesson image

So, what makes it so popular? First, its syntax is clean and intuitive. Code written in Python often looks a lot like plain English, which makes it a great language for beginners. Second, it's incredibly versatile. You can use Python for web development, data analysis, artificial intelligence, scientific computing, and automating everyday tasks. Finally, Python has a massive and supportive community. This means there are countless libraries (collections of pre-written code) and frameworks available to help you build things faster.

Getting Python Ready

Before you can write Python code, you need to install it on your computer. The official Python website is the best place to get it. You'll find installers for Windows, macOS, and Linux. The installation process is straightforward, much like installing any other application.

Lesson image

During installation, you'll see an option like "Add Python to PATH." It's a good idea to check this box, as it makes it easier to run Python from your computer's command line or terminal.

Once installed, you can verify it's working by opening your terminal (or Command Prompt on Windows) and typing python --version. If it's installed correctly, you'll see the version number printed back to you.

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 and gives you a feel for the language's basic syntax.

Open any plain text editor (like Notepad on Windows or TextEdit on Mac) and type the following line of code.

print("Hello, World!")

Let's break that down. print() is a built-in Python function that tells the computer to display something on the screen. Whatever you put inside the parentheses and quotes will be printed as text.

Save the file with a .py extension, for example, hello.py. The .py tells your computer that it's a Python file.

To run it, navigate to the folder where you saved your file in your terminal and type python hello.py. Press Enter, and you should see Hello, World! appear on the next line.

Congratulations! You've just written and executed your first Python program. Notice how little code it took to get a result. That's the simplicity of Python in action.

Ready to check your understanding?

Quiz Questions 1/5

Who is the creator of the Python programming language?

Quiz Questions 2/5

Which of the following is NOT a reason for Python's popularity?

You're now set up and ready to explore what Python can do.