What is Python?
Python is a high-level, interpreted programming language known for its readability and versatility. Created by Guido van Rossum and first released in 1991, Python has become one of the most popular languages in the world.
Python is used for web development, data science, machine learning, automation, scripting, and much more. Its clean syntax makes it an excellent first language to learn.
Why Python?
- → Readable: Python's syntax is clean and close to English, making code easy to read and write.
- → Versatile: Used across web dev, data science, AI, automation, and system scripting.
- → Beginner-friendly: Simple syntax and a gentle learning curve make it ideal for newcomers.
- → Massive ecosystem: Thousands of libraries and frameworks for every use case.
Your first Python code
Python uses indentation to define code blocks instead of braces. Here's a simple example:
Try it
Edit the name and age variables on the left. The output on the right updates as you type.
Readability through indentation
Unlike many languages that use {} to define code blocks, Python uses indentation. This forces you to write visually clean, well-structured code.
# Comments start with a hash symbol
name = "Alice" # Variable assignment
print(name) # Output: Alice
# Indentation defines code blocks
if name == "Alice":
print("Hello, Alice!") # This line is indented
else:
print("Who are you?")
Key concepts
- → print() — Outputs text or values to the console.
- → Variables — Created by simple assignment:
name = "Alice". No type declaration needed. - → Comments — Start with
#and are ignored by the interpreter. - → Indentation — Defines code blocks instead of curly braces.
Quiz
Create variables for your name and age, then print them using an f-string like f"Hello, {name}!"