Python
Python
advanced concepts:
1. Introduction to Python
2. Basic Syntax
Print(“Hello, World!”)
Indentation is mandatory.
Primitive Types
Collection Types
X = 10
Dynamically typed.
Multiple assignment: a, b = 5, 10
5. Operators
Arithmetic: + - * / % // **
6. Control Flow
Conditional
If x > 0:
Print(“Positive”)
Elif x == 0:
Print(“Zero”)
Else:
Print(“Negative”)
Loops
For I in range(5):
Print(i)
While condition:
# do something
7. Functions
Def greet(name):
Print(greet(“Alice”))
8. Lambda Functions
Add = lambda x, y: x + y
9. Object-Oriented Programming
Class Car:
Def __init__(self, color):
Self.color = color
Def drive(self):
My_car = Car(“red”)
My_car.drive()
Try:
X = 10 / 0
Except ZeroDivisionError:
Finally:
Content = f.read()
Import math
Print(math.sqrt(16))
14. Comprehensions
Def decorator_func(func):
Def wrapper():
Print(“Before”)
Func()
Print(“After”)
Return wrapper
@decorator_func
Def say_hello():
Print(“Hello”)
16. Generators
Def gen():
Yield 1
Yield 2
Print(val)
17. File I/O
Matplotlib: visualization
Would you like a PDF version, topic-wise printable notes, or exercises with
solutions for these sections?