Python Notes
Python Notes
The Complete
Python Programming
Language Crash Course
“The Easiest
Python
Programming
Language
Complete Crash
2024
Syllabus Based Python
Programming Crash Course Course”
By Kaushik Shresth
2024 Syllabus Based Python Course
Strings,
Integers, Loops in Python,
Variables in
Floats, Types of Loops,
Python,
Booleans, Loop control
Basics of
Lists, None, statements,
Datatypes.
Dictionary, Infinite Loop.
Tuples & Sets.
2024 Syllabus Based Python Course
Functions in Python,
Operators in Python, PIP in Python,
Function Invocation,
Conditional Statements Everything about pip,
Return Statement,
(if, elif, else), Packages in Python,
Parameters,
Try & Except Statement. Types of Packages.
Default Parameters.
Class,
File Operations
Object/Instance, Practice,
in Python,
Attributes, Projects,
Reading and
Methods, Kuch kaam ki
Writing Files,
Encapsulation, batein tumhare
Everything
Inheritance, liye.
about FileIO.
Polymorphism.
“This Course Is
Designed To Cover
Python Programming
From The Very Basics”
“No Prerequisite,
Just Start Learning”
Kaushik Shresth
“Basics of Programming”
What is
Programming?
Programming refers to the
process of creating sets of
instructions (code) that a
computer can understand and
execute to perform specific
tasks or solve problems.
Who is
Programmer?
A programmer, also known as a
developer or software engineer,
is an individual who writes,
designs, creates, and maintains
computer programs or software
applications.
What is
Python?
Python is a high-level,
interpreted, and versatile
programming language known
for its simplicity and readability.
“History of
Python”
Python, created by Guido van
Rossum, was introduced in 1991.
It aimed to be a readable, high-
level programming language
with a clear, minimalist syntax.
“Advantages
of Learning
Python”
Python's simplicity, adaptability,
and strong community support
make it a favored choice across
industries for its readability,
versatility, and collaborative
environment.
Kaushik Shresth
“Follow The
Tutorial To Learn
More About The
Installation
Process”
Kaushik Shresth
“Basics of Python”
“Basics of Python”
“Variables In Python”
“Variables In
Python”
In Python, variables are used to store data
values. They act as containers for holding
information that can be referenced and
manipulated within a program. Python uses
the equal sign (=) to assign values to
variables. Must start with a letter (a-z, A-Z) or
underscore (_).
Can include letters, numbers, and
underscores. Python variables are case-
sensitive
“Datatypes
In Python”
In Python, data types represent the kind of
value a variable can hold. Python is a
dynamically typed language, which means
you don't need to explicitly declare the data
type of a variable. Instead, Python infers the
data type based on the value assigned to it.
Datatypes - String, Float, Integer, List,
Dictionary, Set, Tuple, Nonetype, Booleans.
Kaushik Shresth
“Strings In Python”
“String In
Python”
In Python, strings are a sequence of characters
enclosed within single quotes (' '), double quotes
(" "), or triple quotes (''' '''). Strings are immutable,
meaning they cannot be changed after they are
created.
You can create strings using single quotes, double
quotes, or triple quotes for multiline strings.
Individual characters in a string can be accessed
using indexing.
You can extract a specific portion (substring) of a
string using slicing.
Strings can be concatenated using the +
operator.
Python has numerous built-in string methods for
various operations such as converting cases,
finding substrings, replacing values, splitting
strings, etc.
Kaushik Shresth
“Integers In Python”
“Integers In
Python”
In Python, integers are whole numbers without
any decimal point. They can be positive or
negative. Python provides support for basic
arithmetic operations and various functions for
working with integers.
Integers are created without specifying the data
type explicitly. They can be assigned directly to
variables.
Python supports various arithmetic operations for
integers such as addition, subtraction,
multiplication, division, modulus, and
exponentiation.
Python has two types of division operators. The
single forward slash (/) performs floating-point
division, while the double forward slash (//)
performs integer division, resulting in a truncated
integer value.
You can convert other data types to integers
using int() function.
Kaushik Shresth
“Floats In Python”
“Floats In
Python”
In Python, floats represent decimal numbers or
numbers with a fractional component. They are
used to represent real numbers and are defined
using a decimal point.
Floats can be created by directly assigning
decimal numbers to variables.
Python supports various arithmetic operations for
floats similar to integers, including addition,
subtraction, multiplication, division, modulus, and
exponentiation.
You can convert other data types to floats using
the float() function.
Kaushik Shresth
“Lists In Python”
“Lists In
Python”
In Python, a list is a versatile data structure that
serves as an ordered collection of items. Lists are
mutable, meaning their elements can be changed
after creation. Lists are enclosed in square
brackets [] and can contain elements of different
data types, including integers, strings, floats,
other lists, and more.Lists can be created by
enclosing elements within square brackets and
separating them with commas.
Elements in a list can be accessed using indexing.
Indexing starts at 0 for the first element.
You can extract a specific portion (slice) of a list
using slicing.
Lists are mutable, so you can change, add, or
remove elements after creation.
Lists support various operations like
concatenation (+), repetition (*), and length
determination (len()).
Kaushik Shresth
“Dictionary In Python”
“Dictionary
In Python”
In Python, a dictionary is a versatile and powerful
data structure used to store collections of key-
value pairs. Dictionaries are unordered, mutable,
and enclosed in curly braces {}. Each key in a
dictionary must be unique and immutable (such
as strings, integers, or tuples), while values can be
of any data type.
Dictionaries are created by defining key-value
pairs within curly braces, separated by colons (:)
and commas (,).
Values in a dictionary are accessed by providing
the corresponding key in square brackets ([]).
Dictionaries are mutable, allowing you to change,
add, or remove key-value pairs.
You can remove elements using the del keyword
or the pop() method.
Kaushik Shresth
“Sets In Python”
“Sets In
Python”
In Python, a set is an unordered collection of
unique elements. Sets are defined by enclosing
comma-separated elements within curly braces
{}. Sets are mutable but have no duplicate
elements. They are particularly useful when
dealing with unique elements or performing
mathematical set operations.
Sets can be created using curly braces {} or by
using the set() constructor.
Sets support various operations like adding
elements, removing elements, and performing
mathematical operations like union, intersection,
difference, etc.
Kaushik Shresth
“Tuples In Python”
“Tuples In
Python”
In Python, a tuple is an ordered and immutable
collection of elements. Tuples are similar to lists,
but once created, their elements cannot be
changed, added, or removed. They are defined
using parentheses () and can contain elements of
different data types.
Tuples can be created by enclosing elements
within parentheses and separating them with
commas.
Elements in a tuple are accessed using indexing
similar to lists. Indexing starts at 0 for the first
element.
You can extract a specific portion (slice) of a
tuple using slicing.
Tuples support operations like concatenation (+),
repetition (*), and length determination (len()).
You can assign values from a tuple into multiple
variables in a single line (tuple unpacking).
Kaushik Shresth
“Loops In Python”
“Loops In Python”
In Python, loops are used to execute a block of code repeatedly until a certain condition
is met. There are mainly two types of loops: for loops and while loops.
for loops are typically used for iterating over while loops continue to execute a block of Python provides control statements like
sequences like lists, tuples, strings, and code as long as a specified condition is true. break, continue, and else in loops.
dictionaries, or any object that supports
iteration.
Kaushik Shresth
“Operators In Python”
“Operators In
Python”
In Python, operators are special symbols or
characters that perform operations on operands
(variables, values, or expressions). Python supports
various types of operators, including arithmetic,
assignment, comparison, logical, identity,
membership, and bitwise operators.
The if statement is used to execute a block of The elif statement allows you to check The else statement is used to execute a block
code if a condition is true. additional conditions if the preceding if of code when the preceding if or elif
statement's condition is false. It stands for conditions are false.
"else if."
Kaushik Shresth
“Functions In Python”
“Functions In
Python”
In Python, a function is a block of reusable code that
performs a specific task or set of tasks. Functions
provide modularity, allowing you to break down your
code into smaller, manageable parts, making it easier
to read, understand, and maintain.
You can define a function in Python using the def
keyword followed by the function name and
parentheses containing any parameters. The
function body is indented below.
Functions can take parameters (inputs) to perform
operations based on the provided values.
Functions can return a value using the return
statement. This value can be stored in a variable or
used in other parts of the code.
You can specify default values for parameters,
allowing the function to be called without providing
those arguments. Also, arguments can be passed
using keyword syntax.
Kaushik Shresth
“Object-oriented programming
In Python”
“Object-oriented programming In Python”
Object-oriented programming (OOP) is a programming
paradigm that uses objects and classes to design and
structure code. In Python, OOP allows you to create
reusable and modular code by defining classes and objects.
Class: A class is a blueprint that defines the attributes
(properties) and methods (functions) common to all
objects of that class.
Object: An object is an instance of a class. It's a realization
of the class, which contains its own unique data and
methods.
Encapsulation refers to the bundling of data (attributes)
and methods that operate on the data within a single unit
(class). It helps in data hiding and abstraction.
nheritance allows a class (called a child or subclass) to
inherit properties and behaviors (attributes and methods)
from another class (called a parent or superclass).
Polymorphism allows objects of different classes to be
treated as objects of a common parent class. It enables
methods to be overridden in a subclass.
Kaushik Shresth
Kaushik Shresth