Lecture 1: Introduction to Python
Python is simple, free, open-source and high-level language. Developed by Guido van Rossum.
Translators convert code to machine language (Compiler/Interpreter). First program: print('Hello
World'). Character set includes letters, digits, symbols, whitespaces and Unicode. Variables store
data (age = 23). Identifiers rules: no digit start, no special symbols, use letters/digits/_ only. Data
Types: int, float, string, boolean, None. Keywords are reserved words (True, False, None).
Comments: # (single), ''' ''' (multi). Operators: Arithmetic, Comparison, Assignment, Logical. Type
casting: int(), float(), str(). Input: input() returns string.
Lecture 2: Strings & Conditionals
String = sequence of characters. Concatenation using +, length using len(). Indexing starts from 0,
negative allowed. Slicing: str[start:end]. Functions: endswith(), capitalize(), replace(), find(), count().
if-elif-else used for decision making.
Lecture 3: Lists & Tuples
List stores multiple values, mutable. Methods: append(), insert(), sort(), reverse(), remove(), pop().
Slicing same as string. Tuple = immutable. Single element tuple needs comma (1,). Methods:
count(), index().
Lecture 4: Dictionaries & Sets
Dictionary stores key:value pairs, no duplicate keys. Methods: keys(), values(), items(), get(),
update(). Nested dictionary allowed. Set = unordered unique elements. Methods: add(), remove(),
clear(), pop(), union(), intersection().
Lecture 5: Loops
while loop runs while condition is true. for loop used for traversal. for-else runs when loop
completes normally. break stops loop, continue skips iteration. range(start, stop, step). pass is
empty statement.
Lecture 6: Functions & Recursion
Functions defined using def. Built-in and user-defined functions. Default parameters allowed.
Recursion = function calling itself.
Lecture 7: File I/O
Files can be text or binary. open() and close() used. Modes: r, w, a, x, b, t, +. read(), readline(),
write(). with open() is better. Delete using [Link]().
Lecture 8: OOP
Class = blueprint, Object = instance. Attributes: class and instance. __init__ constructor runs
automatically. self refers to current object. Methods belong to objects. Static methods use
@staticmethod. Decorators modify functions. Principles: Abstraction and Encapsulation.