Basic To Expert Python (1:1
Session) (CodeWithKolin)
Click To Register
Introduction to Python
What is Python
Interpreter and Compiler
High Level And Low Level
What can python do?
History of python Versions
Key Differences Between Python 2 and 3
New Features in Recent Python Versions (3.7+)
Features Of Python
Setting Up Environment
Install Python in Windows
Install Python in Mac OS
Install Python in Linux
Run Python Code in Command Line
Run Python File in Command Line
Install Community PyCharm in Windows/MacOS
Create a project in PyCharm with Virtual Environment
Beginning Python Basics
The Print Statement
Indentations
Reserved Keywords
Import, From, as Keyword
Basic To Expert Python (1:1 Session) (CodeWithKolin) 1
Comments
Input Function
Constants in Python
Output Formatting
F-strings and Formatted String Literals
Rules Of Variables
Operators in Python
Bitwise Operations
x & y : Bitwise AND
x | y : Bitwise OR
x ^ y : Bitwise XOR
~x : Bitwise NOT
x << y : Left shift
x >> y : Right shift
Mathematical Operations
x + y : Addition
x - y : Subtraction
x * y : Multiplication
x / y : Division (returns a float)
x // y : Floor division
x % y : Modulus (remainder)
x : Negation
+x : Unary plus (rarely used, doesn't change x)
abs(x) : Absolute value
Best Practices and PEP 8
Code Layout
Naming Conventions
Comments and Docstrings
Basic To Expert Python (1:1 Session) (CodeWithKolin) 2
pylint and flake8 for Code Quality
Python Control Flow - Decision Making
If-else Statement
if elif Statement
Nested if Statement
Python Control Flow - Looping
For Loop
Range
Data-Type
While Loop
Boolean Condition
Nested for Loop
Python Control Flow - Branching
Break
Continue
Pass
Functions
User-defined functions
Built-in functions
Anonymous Functions (Lambda)
Understanding Function Arguments and Parameters
Understanding Scope and Lifetime of Variables
Recursive functions
Decorators
Understanding Decorators
Creating and Using Decorators
Function Decorators
Basic To Expert Python (1:1 Session) (CodeWithKolin) 3
Class Decorators
Decorator Syntax
@functools.wraps
Generators and iterators
Iterators
Generators
The Functions any and all
With Statement
Data Compression
Modules
Understanding Modules
Types of Modules
Importing Modules
Creating Modules
__init__.py and Package Structure
Relative vs Absolute Imports
Library
Python library
Creating Python Libraries
Data Type
Type of Data Type
Type Conversion
String
Integer
Float
Complex number
Boolean
Basic To Expert Python (1:1 Session) (CodeWithKolin) 4
List
Tuple
Dictionary
Frozen Set
String
Understanding Strings
Creating and Accessing Characters
String Slicing and Concatenation
String Formatting
String Methods
capitalize() : Converts the first character to upper case
count() : Returns the number of times a specified value occurs in a
string
find() : Searches the string for a specified value and returns the
position of where it was found
format() : Formats specified values in a string
lower() : Converts a string into lower case
upper() : Converts a string into upper case
replace() : Replaces a specified phrase with another specified phrase
split() : Splits the string at the specified separator and returns a list
strip() : Returns a trimmed version of the string
len() : Returns the length of the string
startswith() : Returns true if the string starts with the specified value
endswith() : Returns true if the string ends with the specified value
join() : Joins the elements of an iterable to the end of the string
isnumeric() : Returns True if all characters in the string are numeric
isalpha() : Returns True if all characters in the string are in the
alphabet
Basic To Expert Python (1:1 Session) (CodeWithKolin) 5
: Returns True if all characters in the string are
isalnum()
alphanumeric
isdecimal() : Returns True if all characters in the string are decimals
isdigit() : Returns True if all characters in the string are digits
isidentifier() : Returns True if the string is an identifier
islower() : Returns True if all characters in the string are lower case
isprintable() : Returns True if all characters in the string are printable
isspace() : Returns True if all characters in the string are whitespaces
istitle() : Returns True if the string follows the rules of a title
isupper() : Returns True if all characters in the string are upper case
ljust() : Returns a left-justified version of the string
rjust() : Returns a right-justified version of the string
swapcase() : Swaps cases, lower case becomes upper case and vice
versa
title() : Converts the first character of each word to upper case
: Fills the string with a specified number of 0 values at the
zfill()
beginning
Regular Expressions
Escape Characters
Integer
Understanding Integers (Whole Number)
Performing Arithmetic Operations
Integer Division and Remainder
Integer Overflow
Integer Methods
bit_count(): Returns the number of ones in the binary representation
of the integer
bit_length(): Returns the number of bits necessary to represent the
integer in binary
Basic To Expert Python (1:1 Session) (CodeWithKolin) 6
conjugate(): Returns the complex conjugate of the number (for
integers, this is just the number itself)
to_bytes(length, byteorder, *, signed=False) : Returns an array of bytes
representing the integer
from_bytes(bytes, byteorder, *, signed=False) : Returns the integer
represented by the given array of bytes
as_integer_ratio() : Returns a pair of integers whose ratio is exactly
equal to the original integer (always returns (n, 1) for integers)
is_integer(): Returns True (this method exists for compatibility with
float, always returns True for integers)
numerator : Returns the numerator of the rational number (for
integers, this is the number itself)
denominator: Returns the denominator of the rational number (for
integers, this is always 1)
real : Returns the real part of the number (for integers, this is the
number itself)
imag: Returns the imaginary part of the number (for integers, this is
always 0)
Integer Operations and Functions
abs(x) : Returns the absolute value of x
bin(x) : Returns the binary representation of x as a string
divmod(x, y) : Returns a tuple (x // y, x % y) (quotient and remainder)
float(x) : Converts x to a floating-point number
hex(x) : Returns the hexadecimal representation of x as a string
int(x[, base]) : Converts x to an integer (with an optional base)
max(x, y, ...) : Returns the largest of the given arguments
min(x, y, ...) : Returns the smallest of the given arguments
oct(x) : Returns the octal representation of x as a string
pow(x, y) : Returns x to the power of y
round(x[, n]) : Rounds x to the nearest integer or to n decimal places
Basic To Expert Python (1:1 Session) (CodeWithKolin) 7
sum(iterable) : Returns the sum of all items in an iterable
Float
Understanding Floating-Point Numbers (decimals)
Performing Arithmetic Operations with Floats
Rounding and Formatting Floats
Floating-Point Precision
Float Methods
as_integer_ratio() : Returns a pair of integers whose ratio is exactly
equal to the float
conjugate() : Returns the complex conjugate of the number (for floats,
this is just the number itself)
: Returns a string representation of the float in hexadecimal
hex()
format
is_integer() : Returns True if the float is an integer value, False
otherwise
fromhex(s) : Returns the float represented by a hexadecimal string s
imag: Returns the imaginary part of the number (for floats, this is
always 0.0)
: Returns the real part of the number (for floats, this is the
real
number itself)
Complex Number
Understanding Complex Numbers (real and imaginary parts)
Creating and Accessing Complex Numbers
Performing Arithmetic Operations with Complex Numbers
Complex Methods
: Constructs a complex number. Takes real part
complex(real, imag=0)
and optional imaginary part (defaults to 0).
real(z) : Extracts the real part from a complex number z .
imag(z) : Extracts the imaginary part from a complex number z .
Basic To Expert Python (1:1 Session) (CodeWithKolin) 8
Boolean
Understanding Booleans (True or False)
Working with Boolean Values
Logical Operations (and, or, not)
Conditional Statements
Converting to Booleans
List
Understanding Lists
Creating and Accessing Elements
Modifying Lists (Adding, Removing, Slicing)
List Methods
append(x) : Adds an element x to the end of the list
clear() : Removes all elements from the list
copy() : Returns a shallow copy of the list
count(x) : Returns the number of elements with the specified value x
extend(iterable) : Adds all elements of an iterable to the end of the list
index(x) : Returns the index of the first element with the specified
value x
insert(i, x) : Inserts an element x at the specified position i
pop([i]) : Removes and returns the element at the specified position
i (last element if i is not specified)
remove(x) : Removes the first item with the specified value x
reverse() : Reverses the order of the list
: Sorts the list (in-place) based on the
sort(key=None, reverse=False)
optional key function and reverse flag
List Comprehensions
Tuple
Understanding Tuples
Basic To Expert Python (1:1 Session) (CodeWithKolin) 9
Creating and Accessing Elements
Immutability of Tuples
Use Cases for Tuples
Unpacking Tuples
Tuple Methods
count(x) : Returns the number of times x appears in the tuple
index(x[, start[, end]]): Returns the index of the first occurrence of x
in the tuple (optionally starting from start and ending at end)
Dictionary
Understanding Dictionaries
Creating and Accessing Elements (Keys and Values)
Modifying Dictionaries (Adding, Removing, Updating)
Dictionary Methods
clear() : Removes all items from the dictionary
copy() : Returns a shallow copy of the dictionary
: Creates a new dictionary with keys from seq
fromkeys(seq[, value])
and values set to value
: Returns the value for key if key is in the
get(key[, default])
dictionary, else default
items() : Returns a view object of the dictionary's (key, value) pairs
keys() : Returns a view object of the dictionary's keys
pop(key[, default]) : Removes the item with the specified key and
returns its value
popitem() : Removes and returns the last inserted (key, value) pair
setdefault(key[, default]) : Returns the value of the specified key. If
the key doesn't exist: insert the key, with the specified value
update([other]) : Updates the dictionary with the specified key-value
pairs
values() : Returns a view object of the dictionary's values
Basic To Expert Python (1:1 Session) (CodeWithKolin) 10
Looping Through Dictionaries (Keys, Values, Items)
Set
Understanding Sets
Creating and Adding Elements
Set Operations (Union, Intersection, Difference)
Removing Elements and Checking Membership
Set Methods
add(elem) : Adds an element to the set
clear() : Removes all elements from the set
copy() : Returns a shallow copy of the set
: Returns a new set with elements in the set that
difference(*others)
are not in the others
difference_update(*others) : Removes all elements of another set from
this set
discard(elem) : Removes an element from the set if it is present
intersection(*others) : Returns a new set with elements common to
the set and all others
intersection_update(*others) : Updates the set, keeping only elements
found in it and all others
isdisjoint(other) : Returns True if two sets have a null intersection
issubset(other) : Returns True if another set contains this set
issuperset(other) : Returns True if this set contains another set
pop() : Removes and returns an arbitrary element from the set
remove(elem) : Removes an element from the set; raises KeyError if
not present
: Returns a new set with elements in either
symmetric_difference(other)
the set or other but not both
: Updates the set, keeping only
symmetric_difference_update(other)
elements found in either set, but not in both
Basic To Expert Python (1:1 Session) (CodeWithKolin) 11
union(*others) : Returns a new set with elements from the set and all
others
update(*others) : Updates the set, adding elements from all others
Common Operations
len(s) : Returns the number of elements in set s
x in s : Tests x for membership in s
x not in s : Tests x for non-membership in s
s.issubset(t) or s <= t : Tests whether every element in s is in t
s.issuperset(t) or s >= t : Tests whether every element in t is in s
s.union(t) or s | t : New set with elements from both s and t
s.intersection(t) or s & t : New set with elements common to s and t
s.difference(t) or s - t : New set with elements in s but not in t
s.symmetric_difference(t) or s ^ t : New set with elements in either s
or t but not both
Exceptions & Error Handling (Bullet Points)
Understanding Exceptions:
Understanding Error Handling:
Key Concepts:
try-except Block:
raise Statement:
Common Exception Types:
NameError : Undefined variable referenced.
TypeError : Incompatible data types in an operation.
ValueError : Inappropriate value passed to a function/operation.
ZeroDivisionError : Division by zero.
IndexError : Accessing element outside list/string index range.
Many more built-in exceptions for various error scenarios.
finally Block :
Basic To Expert Python (1:1 Session) (CodeWithKolin) 12
Executes regardless of exceptions (commonly for cleanup
tasks).
OOPs Concept:
Understanding Classes and Objects:
Attributes and Methods:
Constructors ( __init__ method):
Object Instantiation:
Method Calls and self Argument
Advanced Concepts (Expand Your Knowledge):
Inheritance:
A fundamental concept in OOP where a new class is based on an
existing class, inheriting its attributes and methods. This allows
for code reuse and the creation of hierarchical relationships
between classes.
Single Inheritance
Multiple Inheritance
Method Resolution Order (MRO)
Polymorphism:
The ability of objects of different classes to be used
interchangeably when they share a common interface. It allows
methods to use objects of any of the polymorphic classes without
needing to know which class the object belongs to.
Method Overriding
Duck Typing
Operator Overloading:
A feature that allows the redefinition of operators for custom
classes. This enables objects of custom classes to behave
similarly to built-in types, making the code more intuitive and
readable.
Basic To Expert Python (1:1 Session) (CodeWithKolin) 13
Data Encapsulation:
Also known as data hiding, it's the bundling of data with the
methods that operate on that data. Encapsulation restricts direct
access to some of an object's components, which is a means of
preventing accidental interference and misuse of the methods
and data.
Private and Protected Attributes
Property Decorators: @property , @setter , @deleter
Class Variables vs. Instance Variables:
Class variables are shared among all instances of a class and are
defined within the class. Instance variables are unique to each
instance and are defined within methods. This distinction allows
for both shared state and instance-specific state within objects.
Class methods:
Methods that are bound to the class and not the instance. They
have access to the class state and can modify class-level
variables. Class methods are defined using the @classmethod
decorator and take the class as their first parameter,
conventionally named 'cls'.
Static methods:
Methods that are bound to a class rather than its object. They
don't access or modify the class state and are defined using the
@staticmethod decorator. They behave like plain functions but
belong to the class's namespace.
Abstract Classes:
Classes that cannot be instantiated and may contain abstract
methods (methods without a body). They serve as a base for
subclasses and are used to define a common interface. In
Python, the abc module is used to define abstract classes.
abc Module
@abstractmethod Decorator
File Handling and Exception Handling
Basic To Expert Python (1:1 Session) (CodeWithKolin) 14
Reading and Writing Files
Understanding Exceptions
Handling Exceptions
Raising Exceptions
Advance Python
Context Managers
Understanding Context Managers
The with Statement
Creating Custom Context Managers
The contextlib Module
__enter__ and __exit__ Methods
Concurrency
Multithreading
threading Module
Creating and Managing Threads
Thread Synchronization
Multiprocessing
multiprocessing Module
Process vs Thread
Pool of Workers
Asynchronous Programming
asyncio Module
Coroutines and async / await Syntax
Networking
Socket Programming
HTTP Requests with requests Library
Basic To Expert Python (1:1 Session) (CodeWithKolin) 15
Working with APIs
Database Interactions
SQLite with Python
Using SQL Databases (MySQL, PostgreSQL)
ORMs (SQLAlchemy)
Web Development
Introduction to Flask
Basic Route Handling
Templates and Jinja2
RESTful API Development
Testing
Unit Testing with unittest
Test Discovery
Mocking with unittest.mock
Introduction to pytest
Virtual Environments and Package Management
Creating Virtual Environments
venv Module
Using pip
Creating and Using requirements.txt
Type Hinting
Basic Type Annotations
Complex Types ( List , Dict , Tuple , etc.)
Optional and Union Types
mypy for Static Type Checking
Enhanced Exception Handling
Custom Exceptions
Exception Chaining
Basic To Expert Python (1:1 Session) (CodeWithKolin) 16
Context Managers for Exception Handling
Debugging with pdb
Advanced Python Concepts
Metaclasses
Descriptors
Coroutines
Generators and yield from
Data Science and Machine Learning Libraries
NumPy Basics
Pandas for Data Manipulation
Matplotlib for Data Visualization
Scikit-learn for Machine Learning
Basic To Expert Python (1:1 Session) (CodeWithKolin) 17