Python 1707650972
Python 1707650972
String: Sequence of characters, enclosed –“ ”/’ ’/””” “””, ordered, immutable, duplicates allowed
Accessing Items: Indexing ,slicing and for loop
Functions: capitalize(), title(), upper(), lower(), lstrip() ,rstrip() ,strip(), swapcase(), replace(), find(),
split(), join() ,endswith(), startswith(), del, index(), count(), isalnum(), isalpha(), isdecimal(), isdigit(),
isnumeric(), islower() ,isupper(), istitle(), isspace(), zfill(),center().
List: collection of heterogeneous datatype, enclosed –[ ], ordered, mutable duplicates allowed
Accessing Items: Indexing ,slicing and for loop
Functions: append(), extend(), insert(), remove(), pop(), clear(), del, sort(), reverse(), index(), count()
Tuple: collection of heterogeneous datatype, enclosed –( ), ordered, immutable, duplicates allow
Accessing Items: Indexing ,slicing and for loop
Functions: Index(), count()
Set: collection of immutable items, enclosed in –{ }.,unordered, mutable, duplicates not allows
Accessing Items:for loop
Functions:remove(), discard(), pop(), clear(), del, add(), update(), union(), intersection(),
intersection_update, difference() ,difference_update() ,symmetric_difference,
symmetric_difference_update(), issubset(), issuperset(), isdisjoint(),
Frozen set: collection of immutable items, enclosed in –{()}.,unordered, immutable, duplicates not
allow.
Accessing Items:for loop
Functions: Union(), intersection(), difference(), symmetric_difference.
Dictionary: collection of key and value pairs, enclosed in –{ }., ordered, mutable, duplicates allows
Keys:immutable,Values:mutables
Accessing Items: Indexing ,slicing and for loop
Functions:Dict_name[keyname], update(), pop(), popitems(), clear(), del, fromkeys(),setdefault().
Bool: True and False
Key Features: Easy to learn and use,Expressive,Interpreted,cross platform,free and open source,OOp
lang,vast library support,GUI support,Embeddable ,Dynamic
Applications:Web,software development, Business, Enterprise, Image processing, Game ,Audio & Video
based,Console-based,Desktop GUI.
For loop: for var_name in (sequence): iterate,which means when we know how many times a
(conditions) statement has to be executed
(statements)
…………………
Nested for loop: for var_name1 in (sequence): We can use number of times for loops inside a for loop
for var_name2 in (sequence2):
(conditions)
(statements)
…………………
While loop: While condition: Use to iterations but we have to initialize and increment
(Statements) value manually
…….
Nested while loop: While condition: We can use number of times While loops inside a for loop
While condition:
(Statements)
…….
For else: for var_name1 in (sequence): After for/while block else block is executed
While else: or
While condition: (Statements)
else:
states
List comprehension: [expression for loop if condition] It provides a short syntax for creating a new list based
on the values of an existing list.
Loop control state: Break:It is use in only loop,it stop further lines of code and iterations
Continue:Its stop current iterations and it continue with next iteratio
zip()
filter()
map()
all()
any()
chr()
Ord()
bin()
bool()
enumerate()
range()
print()
input()
eval()
abs()
dir()
round()
iter()
pow()
divmod()
open()
Object:It is physical entity,Every thing in python is an object.
Method:It is function in say as method in class.
Self:It is keyword and it is mandatory as first parameter in method, also use to access
variable and methods inside the class.
__init__ method: It is reserved method in python,it will get automatically executed when
we create an object ,we can access parameters of the class in __init__method
calling__init__ method in child class:We can call parent’s __init__ method in child class by
two ways 1)By Parent class name, 2)By super()
1.Inheritance:Inheritance allows a class to inherit the properties from other class
i)Single Inheritance Child class is derived from only one parent class called single inheritance
ii)Multilevel Inheritance The inheritance of a derived class from another derived class is called as
multilevel inheritance
iii)Multiple Inheritance When a class is derived from more than one base class it is called multiple
Inheritance.
iv)Hierachical Inheritanve When more than one classes are derived from one base class it is called
Hierachical Inheritance
v)Hybrid Inheritance It may be contain more than one type of inheritance
2.Polymorphism: We can use same function but with different signature into multiple classes
3.Encapsulation: Provide protection for data modification with the help of private
modifiers.
Name mangling: We can modify private method with the help of name mangling
Hence we can say that python is not 100% OOPs lang.
4.Abstraction: First we need to inmport library ,Use to hide the internal functionality and we
can also say that it can hide complexity of program with the help of @abstractmethod
Overriding: when parent and child class contain same function name then parent class get
overridden by child class .
Overloading:when many classes contain same function but different parameters called as
overloading.