🟢 Beginner · Lesson 01
Introduction to Python
What is Python?
Python is a high-level, general-purpose programming language created by Guido van Rossum in 1991. It is known for clean, English-like syntax that is easy to read and write — which is why it is the recommended first language in CBSE Class 11/12 and most B.Tech courses.
💡 In one line
Python lets you write less code to do more work. A task that needs 10 lines in C or Java often needs just 2-3 lines in Python.
Why Python is So Popular
- Simple syntax — reads almost like English.
- Beginner-friendly — no semicolons, no type declarations.
- Huge libraries — NumPy, Pandas, Django, TensorFlow ready to use.
- Cross-platform — same code runs on Windows, Linux, Mac.
- In demand — used in AI, data science, web and automation jobs.
Where Python is Used
| Field | Example |
|---|---|
| Data Science & AI | Pandas, scikit-learn, TensorFlow |
| Web Development | Django, Flask |
| Automation / Scripting | File handling, web scraping |
| Apps & Games | Tkinter, PyGame |
Program 1: Your First Line
Python – first.py
print("Hello, I am learning Python!")Hello, I am learning Python!
print()is a built-in function that shows text on screen.- The text inside quotes is a string.
- No semicolon needed at the end — Python uses the line break.
Program 2: A Tiny Calculator
Python – add.py
a = 10
b = 5
print("Sum :", a + b)
print("Diff :", a - b)
print("Product :", a * b)
print("Divide :", a / b)Sum : 15
Diff : 5
Product : 50
Divide : 2.0
- Variables
aandbhold numbers. + - * /are arithmetic operators.- Notice
/gives2.0(a float) — Python division always returns a decimal.
Key Features
- Interpreted — runs line by line, no separate compile step.
- Dynamically typed — no need to declare variable types.
- Object-oriented — supports classes and objects.
- Free & open-source.
Short History
Python was created by Guido van Rossum and released in 1991. The name comes from the comedy group "Monty Python", not the snake. Python 3 (released 2008) is the modern version used today.
Common Mistakes
- Installing/using old Python 2 instead of Python 3.
- Forgetting quotes around text in
print(). - Mixing tabs and spaces for indentation.
Practice Tasks
- Print your name and class on two separate lines.
- Store two numbers and print all four arithmetic results.
- Print a small paragraph about why you want to learn Python.
Summary
- Python is a simple, high-level, interpreted language.
- Used in AI, data science, web and automation.
print()displays output; no semicolons needed.- Always use Python 3.
💻 Live Code Editor
This page's programs are ready here — run them, edit them, and learn. No installation needed.
Powered by OneCompiler. The code loads into the editor automatically — press Run to see the output. If the editor does not open, open it in a new tab.