1) What is Python?
Python is a high-level, interpreted language. “Interpreted” means you can run Python code without compiling it into a separate executable first. Python focuses on readability and has a clean syntax.
- Automation (rename files, read Excel, scrape data, send messages)
- Web development (Django, Flask, FastAPI)
- Data + AI (pandas, NumPy, scikit-learn, PyTorch)
- Scripting and tooling (DevOps, testing, CI/CD)
2) Setup: Install Python & choose an editor
Option A: Install on Windows / macOS / Linux
- Download Python from the official site (see Links).
- On Windows: during install, tick “Add Python to PATH”.
- Verify in terminal/command prompt:
python --version pip --version
Option B: Start online (no installation)
Use the Pyodide editor below to run Python directly in your browser.
Recommended editor
VS Code
Best all-round editor. Add the “Python” extension and you’re ready.
PyCharm (Community)
A full IDE focused on Python (heavier but powerful).
3) Your first Python program
Create a file named hello.py and write:
print("Hello, World!")
Run it in terminal:
python hello.py
4) Python basics you must know
4.1 Variables (store data)
name = "Champak"
age = 20 pi = 3.14159 is_student = True
4.2 Data types (common ones)
# String
city = "Varanasi"
Integer and Float
count = 10 price = 99.50
Boolean
is_open = False
List (ordered, changeable)
nums = [1, 2, 3]
Tuple (ordered, not changeable)
point = (10, 20)
Dictionary (key-value)
student = {"name": "Asha", "marks": 92}
Set (unique items)
unique = {1, 2, 2, 3} # becomes {1, 2, 3}
4.3 Input and output
name = input("Enter your name: ")
print("Hello,", name)
4.4 Conditions (if / elif / else)
marks = 72
if marks >= 90: print("Grade: A") elif marks >= 75: print("Grade: B") else: print("Grade: C")
4.5 Loops (repeat work)
# for loop
for i in range(5): print(i)
while loop
n = 3 while n > 0: print("Countdown:", n) n -= 1
4.6 Functions (reuse code)
def add(a, b):
return a + b
result = add(3, 4) print(result)
4.7 Imports (use libraries)
import math
print(math.sqrt(81))
5) Packages, pip, and virtual environments
Python has a package manager called pip. Install packages like this:
pip install requests
Create a virtual environment
# create venv
python -m venv .venv
activate (Windows)
.venv\Scripts\activate
activate (macOS/Linux)
source .venv/bin/activate
Then install packages inside it
pip install requests
6) Mini practice (do these today)
- Print your name and age in one line.
- Take two numbers as input and print their sum.
- Check if a number is even or odd.
- Print numbers 1 to 20 using a
forloop. - Make a function that returns the square of a number.
7) Pyodide Python Editor (Run Python in Browser)
Click Load Pyodide first. If you opened the page as file:///, use a local server (VS Code Live Server) or host the page.
file:///.Many browsers block loading Pyodide from CDNs in local-file mode.
Fix: open using VS Code Live Server (
http://localhost) or host on GitHub Pages.
Output
Output will appear here…
while True loops. Use for i in range(...) or a counter.8) What to learn next
- Strings and string methods
- Lists, tuples, sets, dictionaries (more deeply)
- File handling (read/write files)
- Errors and exceptions (
try/except) - OOP (classes and objects)
- Modules, packages, and project structure