1. Introduction to Python

Python is one of the most popular programming languages in the world. It is known for being simple, readable, and powerful. Python is used in web development, artificial intelligence, game development, automation, cybersecurity, and data science.

One of the biggest advantages of Python is that its code looks close to normal English. This makes it easier for beginners to understand compared to many other programming languages.

Companies like Google, Instagram, YouTube, and Netflix use Python in their systems. Learning Python opens doors to many career paths in technology.

2. Python Syntax

Syntax means the rules we must follow when writing code. Python has very clean and simple syntax. Unlike many other languages, Python does not use curly brackets { } to group code. Instead, it uses indentation (spaces at the beginning of a line).

Each line of Python code represents an instruction. The most common first program is printing text to the screen.

print("Hello, World!")
Hello, World!

The print() function tells Python to display something on the screen.

3. Variables

Variables are like containers that store information. You can store names, numbers, or other data inside them and use them later in your program.

In Python, you don’t need to tell the computer what type of data the variable will hold. Python automatically understands it.

name = "Dhanush" age = 21 print(name, age)
Dhanush 21

Here, name stores text and age stores a number.

4. Data Types

Data types tell Python what kind of data we are working with.

int → Whole numbers (10, 50, -3)

float → Decimal numbers (3.14, 2.5)

str → Text ("Hello")

bool → True or False values

x = 10 y = 3.14 text = "Hi" flag = True

Each variable above stores a different type of data.

5. Conditions

Conditions allow a program to make decisions. Python uses if, elif, and else to check conditions.

The program checks if something is true. If it is, one block of code runs. If not, another block runs.

age = 18 if age >= 18: print("Adult") else: print("Minor")
Adult

6. Loops

Loops are used when we want to repeat code multiple times. Instead of writing the same code again and again, we use loops.

A for loop repeats code a fixed number of times.

for i in range(5): print(i)
0 1 2 3 4

7. Functions

Functions are reusable blocks of code. Instead of writing the same logic many times, we put it inside a function and call it whenever needed.

def greet(name): return "Hello " + name print(greet("Alex"))
Hello Alex

8. Lists

Lists store multiple values in a single variable. They are ordered and can be changed.

fruits = ["Apple", "Banana", "Cherry"] for fruit in fruits: print(fruit)
Apple Banana Cherry

9. Dictionaries

Dictionaries store data as key-value pairs. Instead of using indexes like lists, we use keys.

person = {"name": "Alex", "age": 25} print(person["name"])
Alex

10. OOP Basics

Object-Oriented Programming (OOP) is a way of structuring programs using classes and objects. A class is like a blueprint, and an object is something created from that blueprint.

class Dog: def __init__(self, name): self.name = name dog1 = Dog("Buddy") print(dog1.name)
Buddy