📘 Lesson 01 · Beginner

Introduction to Python

Discover what Python is, why it's the world's most popular language, and write your first program.

What is Python?

Python is a high-level, interpreted programming language created by Guido van Rossum and first released in 1991. "High-level" means the code reads almost like plain English — you don't need to manage memory or worry about hardware. "Interpreted" means each line is executed immediately, so you get instant feedback without a separate compile step.

Python is used in web development (Django, Flask), data science (pandas, NumPy), AI and machine learning (TensorFlow, PyTorch), scripting, automation, and much more. It consistently ranks as the world's most popular programming language.

💡
Python ranks #1 in the TIOBE index and Stack Overflow surveys. Over 8 million developers use it worldwide.

Your First Python Program

The print() function displays output on the screen. By tradition, every programmer's first program prints "Hello, World!" — it confirms your environment works. In Python this takes exactly one line:

hello.py
# The # symbol starts a comment — Python ignores it
print("Hello, World!")
print("Welcome to Python 🐍")
▶ Output
Hello, World!
Welcome to Python 🐍

No semicolons, no curly braces, no class declarations needed. The text inside the quotes is called a string. Notice Python automatically adds a newline after each print() call.

Python as a Calculator

Python can be used as an instant calculator. All standard operators work as expected. Two special ones worth noting: ** raises to a power, and // is floor division — it divides and rounds down, always giving a whole number. The % (modulus) operator returns the remainder after division, which is very useful for checking if a number is even or odd.

calc.py
print(10 + 5)      # addition
print(100 / 4)    # division — always gives a float
print(2 ** 8)      # 2 to the power of 8
print(17 // 3)     # floor division: 17÷3 = 5 remainder 2
print(17 % 3)      # modulus: just the remainder
▶ Output
15
25.0
256
5
2

Variables — Storing Data

A variable is a named container for a value. You create one by writing a name, then =, then the value. Python automatically figures out the type — no declaration needed. This is called dynamic typing. Variable names should be lowercase with underscores (e.g. first_name) and cannot start with a number.

variables.py
name = "Alice"       # text string
age = 28             # whole number (int)
height = 1.72        # decimal (float)
is_student = True    # True or False (bool)

print("Name:", name)
print("Age:", age)
print("Height:", height, "m")
print("Student?", is_student)
▶ Output
Name: Alice
Age: 28
Height: 1.72 m
Student? True

When you pass multiple values to print() separated by commas, Python puts a space between each one automatically. You can reassign a variable at any time — the old value is simply replaced.

Python is case-sensitive: name and Name are two different variables. Always use lowercase_with_underscores for variable names.

🧠 Quick Check

Who created Python?

Linus Torvalds
Guido van Rossum
James Gosling
Brendan Eich

Tags

pythonintroductionbeginnerhello worldprintpython basics