← Back to Learn
🐍

Beginner â€ĸ Python

Python Basics

Lesson 1 of 5
Step 1

🐍 What is Python?

Python is a programming language that lets us give instructions to a computer. It is popular because its code is easy to read and understand. Python can be used to create games, websites, apps, tools, and many other types of programs. When we write Python code, the computer follows our instructions and produces a result.

🐍 Python
print("Hello, Python!")
â–ļ Output
Hello, Python!
⭐ Earn 10 XP
🧩 Want to practice? Try the Python Basics exercises →

📚 Everything in Python Basics

Learn what Python is, how programs work, how to display information, and how to write your first Python programs. Here is every step in this topic in one place, so you can review what you learned or jump straight to a step.

  1. 🐍 What is Python?

    Python is a programming language that lets us give instructions to a computer. It is popular because its code is easy to read and understand. Python can be used to create games, websites, apps, tools, and many other types of programs. When we write Python code, the computer follows our instructions and produces a result.

    print("Hello, Python!")
  2. đŸ’ģ Your First Python Program

    The print() function is one of the first Python commands you will learn. It tells Python to display information on the screen. You can use print() to display words, numbers, and the results of calculations. Text is written inside quotation marks, while numbers can be written without quotation marks.

    print("Hello!")
    print(10)
    print(5 + 3)
  3. đŸ–¨ī¸ Printing Text and Numbers

    Python can print different kinds of information. Text is called a string and is usually placed inside quotation marks. Numbers can be printed directly. We can also print more than one piece of information using commas.

    print("My name is Alex")
    print(12)
    print("My age is", 12)
  4. đŸ’Ŧ Python Comments

    Comments are notes that programmers write inside their code to explain what the code does. Python ignores comments when the program runs. A comment starts with the # symbol. Comments can make programs easier to understand, especially when the code becomes longer.

    # This is a comment
    print("I love Python!")
    
    # Python ignores this note
    print("Let's learn!")
  5. 🧮 Doing Math in Python

    Python can work like a calculator. We can use mathematical operators such as + for addition, - for subtraction, * for multiplication, and / for division. Python calculates the expression and gives us the result.

    print(5 + 3)
    print(10 - 4)
    print(3 * 4)
    print(10 / 2)