No history yet

Introduction to Python

What is Python?

Python is a programming language, which is a way to give instructions to a computer. Think of it like a recipe for a cake. You provide a list of steps in a specific order, and the computer follows them to produce a result. What makes Python so popular is that its syntax, or its set of rules, is designed to be clean and readable. It often looks a lot like plain English, which makes it one of the best languages for beginners to learn.

Lesson image

Despite its simplicity, Python is incredibly powerful. It's used by major companies for everything from building websites (like Instagram and Spotify) to analyzing huge amounts of data, creating artificial intelligence, and automating repetitive tasks. Learning Python opens up a wide range of possibilities.

Your Programming Toolkit

To write and run your Python code, you'll need a special program called an Integrated Development Environment, or IDE. An IDE is like a workshop for a programmer. It includes a text editor for writing your code, tools for running it, and features that help you find and fix mistakes. It bundles everything you need into one convenient place.

For this course, we'll use Thonny, an IDE made specifically for beginners. It has a simple interface and provides helpful feedback, making it easier to focus on learning the language itself.

Lesson image

Writing Your First Program

It's a long-standing tradition in programming to make your first program display the message "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. Let's do it in Python.

print("Hello, World!")

Type that single line of code into Thonny's editor and press the green "Run" button. In the output area, usually at the bottom of the window, you should see the text Hello, World! appear.

Let's break down that one line of code:

  • print: This is a function. A function is a named block of code that performs a specific action. The print() function's job is to display things on the screen.
  • (): The parentheses after a function name are where you provide arguments—the information the function needs to do its job. In this case, we're giving it the text we want it to print.
  • "Hello, World!": The text inside the parentheses is the argument. The quotation marks are crucial. They tell Python that this is a string, which is a sequence of characters. Without them, Python would try to interpret Hello and World as commands and would give you an error.

In programming, any sequence of text, like a word or a sentence, wrapped in quotation marks is called a string.

Now, try experimenting. Change the text inside the quotation marks to something else and run the program again. See what happens. This is the best way to learn: by doing.

Quiz Questions 1/4

What is the primary purpose of an Integrated Development Environment (IDE) like Thonny?

Quiz Questions 2/4

In the Python command print("Hello, World!"), what is the specific role of the quotation marks?

Congratulations on writing your first program! You've taken the first and most important step in learning to code.