No history yet

Introduction to Python

What Is Python?

Python is a programming language known for its readability. Its design philosophy emphasizes code that is easy to read and write, which makes it a great choice for beginners. It was created in the late 1980s by Guido van Rossum, who wanted to make a language that was both powerful and straightforward.

Lesson image

Today, Python is one of the most popular languages in the world. It’s used for a huge variety of tasks, from building websites and automating repetitive tasks to analyzing data and training artificial intelligence models. Companies like Google, Netflix, and Instagram use it extensively in their operations.

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 a program that understands your Python code and executes its instructions. You can download it for free from the official Python website, python.org.

Make sure to check the box that says "Add python.exe to PATH" during installation on Windows. This makes it easier to run Python from your computer's command line.

While you could write code in a simple text editor, most developers use an Integrated Development Environment, or IDE. An IDE is software that combines a text editor with other helpful tools, like code completion and a debugger, making the process of writing and testing code much smoother.

Lesson image

There are many great IDEs to choose from. For beginners, some of the most popular options are Visual Studio Code (VS Code), PyCharm, and Thonny. Any of these will work well, so pick one that looks appealing and install it on your computer.

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 a first taste of the language's syntax.

In Python, this is done with the print() function. A function is a named block of code that performs a specific task. The print() function's job is to display whatever you put inside its parentheses.

print("Hello, World!")

To run this code, open your IDE and create a new file. Save it with a .py extension, which tells your computer it's a Python file. For example, you could name it hello.py.

Type the line of code above into your file and save it. Most IDEs have a "Run" button (often a green triangle) that will execute the code for you. The output, Hello, World!, will appear in a terminal or console window within your IDE.

Lesson image

Congratulations, you've just written and run your first Python program. You've taken the first step into the world of programming.