0% found this document useful (0 votes)
5 views39 pages

Python Developer Application & OOP Guide

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views39 pages

Python Developer Application & OOP Guide

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

11/9/25, 10:31 PM Application modification


Dear Rakesh,
I hope you are doing well. am writing to express my
interest in the Fresher – Python Developer position at
Boston Technology Corporation (BTC). I have recently
completed my [Link] in Computer Science and
Engineering from Kalasalingam Academy of Research
and Education with CGPA 8.0 and have undergone
Python Full Stack Development training at Thopstech
Career Solutions Pvt. Ltd., where I gained hands-on
experience working on real-time projects.

I am currently located in Bengaluru and would be glad


to attend the face-to-face interview drive. Please find
my updated resume attached for your review.

Thank you for your time and consideration.

Best regards,
Chandeshwer Reddy Chintham
Bengaluru
+91 8374753946
chandeswer9567@[Link] ᐧ

Application for Graduate Hiring Program

modify for this

Here is a polished and modified version suited for Application for Graduate Hiring
Program:

Subject: Application for Graduate Hiring Program – Python Developer (Fresher)

Dear Rakesh,

I hope you are doing well.


I am writing to express my interest in the Graduate Hiring Program for the position of
Fresher – Python Developer at Boston Technology Corporation (BTC). I have recently
completed my [Link] in Computer Science and Engineering from Kalasalingam

[Link] 1/39
11/9/25, 10:31 PM Application modification

Academy of Research and Education with a CGPA of 8.0. I have also undergone Python 
Full Stack Development training at Thopstech Career Solutions Pvt. Ltd., where I
gained hands-on experience working on real-time projects.

I am currently based in Bengaluru and would be glad to attend the face-to-face


interview drive. Please find my updated resume attached for your review.

Thank you for your time and consideration. I look forward to the opportunity to
contribute and grow with BTC.

Best regards,
Chandeshwer Reddy Chintham
Bengaluru
+91 8374753946
chandeswer9567@[Link]

If you'd like, I can also format this into a more formal email template or create a
version tailored to HR screening.

oops in python in evey detailed

Here is a clear, fully detailed, structured explanation of OOP (Object-Oriented


Programming) in Python, written in an easy-to-understand and interview-friendly
way.

✅ OOPS in Python — Complete Detailed Explanation


Object-Oriented Programming (OOP) is a programming paradigm based on the
concept of objects and classes. Python supports OOP and provides powerful features
to implement real-world modeling.

✅ 1. What is a Class in Python?


[Link] 2/39
11/9/25, 10:31 PM Application modification

A class is a blueprint or template for creating objects. 


It defines attributes (variables) and behaviors (methods).

✅ Example:
python Copy code

class Student:
name = "Chandu"
age = 22

✅ 2. What is an Object in Python?


An object is an instance of a class.
It has its own identity, state, and behavior.

✅ Example:
python Copy code

s1 = Student()
print([Link])
print([Link])

✅ 3. Important OOP Concepts in Python

✅ 3.1 Encapsulation
Encapsulation means binding data and functions together and restricting direct
access.

Python uses public, protected, and private access levels:

Type Syntax Meaning

Public name Can be accessed anywhere

Protected _name For internal use, but still accessible

[Link] 3/39
11/9/25, 10:31 PM Application modification

Type Syntax Meaning 


Private __name Cannot be accessed directly

✅ Example:
python Copy code

class Employee:
def __init__(self, name, salary):
[Link] = name # public
self._department = "IT" # protected
self.__salary = salary # private

emp = Employee("Ravi", 50000)


print([Link])
print(emp._department)
# print(emp.__salary) # Error
print(emp._Employee__salary) # Accessing private (name-mangling)

✅ 3.2 Abstraction
Abstraction means showing only essential details and hiding complex implementation.

Python uses abstract classes via abc module.

✅ Example:
python Copy code

from abc import ABC, abstractmethod

class Car(ABC):
@abstractmethod
def mileage(self):
pass

class BMW(Car):
def mileage(self):
print("Mileage is 20 kmpl")

[Link] 4/39
11/9/25, 10:31 PM Application modification

c = BMW()

[Link]()

✅ 3.3 Inheritance
Inheritance allows one class (child/subclass) to acquire data and behavior from
another (parent/base class).

✅ Types of inheritance in Python:


1. Single inheritance
2. Multiple inheritance
3. Multilevel inheritance
4. Hierarchical inheritance
5. Hybrid inheritance

✅ Single Inheritance Example:


python Copy code

class Parent:
def display(self):
print("Parent class")

class Child(Parent):
pass

obj = Child()
[Link]()

✅ Multiple Inheritance Example:


python Copy code

class A:
def funA(self):
print("A")

class B:
[Link] 5/39
11/9/25, 10:31 PM Application modification

def funB(self):

print("B")

class C(A, B):


pass

c = C()
[Link]()
[Link]()

✅ Multilevel Inheritance Example:


python Copy code

class A:
pass

class B(A):
pass

class C(B):
pass

✅ 3.4 Polymorphism
Polymorphism means one name, many forms.

✅ Method Overriding (Runtime Polymorphism)


python Copy code

class Animal:
def sound(self):
print("Some sound")

class Dog(Animal):
def sound(self):
print("Bark")

[Link] 6/39
11/9/25, 10:31 PM Application modification

obj = Dog()

[Link]()

✅ Polymorphism with functions


python Copy code

def add(a, b, c=0):


return a + b + c

print(add(10, 20))
print(add(10, 20, 30))

✅ 4. Constructor in Python
__init__() is the constructor, called automatically when an object is created.

✅ Example:
python Copy code

class Student:
def __init__(self, name, age):
[Link] = name
[Link] = age

s = Student("Chandu", 22)
print([Link], [Link])

✅ 5. Destructor in Python
__del__() method is used as a destructor, called when object is deleted.

python Copy code

class Test:
def __del__(self):
print("Destructor called")

[Link] 7/39
11/9/25, 10:31 PM Application modification

t = Test()

del t

✅ 6. Method Types in Python


Python has 3 types of methods:

Method Type Decorator Description

Instance Method none Works on object instance

Class Method @classmethod Works on class level

Static Method @staticmethod No access to instance or class

✅ Instance method Example:


python Copy code

class Example:
def instance_method(self):
print("Instance method")

✅ Class method Example:


python Copy code

class Example:
count = 0
@classmethod
def show_count(cls):
print([Link])

✅ Static method Example:


python Copy code

[Link] 8/39
11/9/25, 10:31 PM Application modification

class Math:

@staticmethod
def add(a, b):
return a + b

print([Link](5, 3))

✅ 7. Operator Overloading
Python allows operators to have different meanings depending on object type.

✅ Example:
python Copy code

class Number:
def __init__(self, value):
[Link] = value

def __add__(self, other):


return [Link] + [Link]

n1 = Number(10)
n2 = Number(20)

print(n1 + n2)

✅ 8. In-built Special Methods (Dunder Methods)


Method Purpose

__init__() constructor

__str__() string representation

__len__() length

__add__() + operator

__eq__() == operator

[Link] 9/39
11/9/25, 10:31 PM Application modification

Method Purpose 
__del__() destructor

✅ 9. Real-Time OOP Example


python Copy code

class BankAccount:
def __init__(self, name, balance):
[Link] = name
self.__balance = balance

def deposit(self, amount):


self.__balance += amount

def withdraw(self, amount):


if amount <= self.__balance:
self.__balance -= amount
else:
print("Insufficient balance")

def get_balance(self):
return self.__balance

acc = BankAccount("Chandu", 5000)


[Link](2000)
print(acc.get_balance())

✅ Done ✅
If you want, I can also provide:

✅ OOP interview questions


✅ OOP project-based example
✅ OOP notes in PDF format

Just tell me!

[Link] 10/39
11/9/25, 10:31 PM Application modification

Decorators

Here is a clear, complete, and interview-standard explanation of Decorators in


Python with examples from beginners to advanced.

✅ Decorators in Python — Complete Explanation


A decorator in Python is a function that takes another function as input, adds extra
functionality to it, and returns a modified function without changing the original
function’s code.

✅ 1. Why Decorators?
They are used to:

✅ Add extra features to a function


✅ Avoid repeating code
✅ Follow DRY (Don’t Repeat Yourself) principle
✅ Add logging, security checks, performance tracking, etc.

✅ 2. Basic Decorator Structure


python Copy code

def my_decorator(func):
def wrapper():
print("Before function execution")
func()
print("After function execution")
return wrapper

Using decorator:

python Copy code

[Link] 11/39
11/9/25, 10:31 PM Application modification

@my_decorator

def display():
print("Inside function")

display()

✅ 3. How Decorators Work Internally


When you use:

python Copy code

@my_decorator
def display():
print("Inside function")

It is equivalent to:

python Copy code

display = my_decorator(display)

✅ 4. Decorator with Arguments


If the decorated function takes arguments, wrapper must accept them.

✅ Example:

python Copy code

def my_decorator(func):
def wrapper(*args, **kwargs):
print("Before function")
result = func(*args, **kwargs)
print("After function")
return result
return wrapper

@my_decorator
def add(a, b):

[Link] 12/39
11/9/25, 10:31 PM Application modification

return a + b

print(add(10, 20))

✅ 5. Decorator with Return Value


Decorator must return function result.

✅ Example:

python Copy code

def square_decorator(func):
def wrapper(num):
value = func(num)
return value * value
return wrapper

@square_decorator
def get_number(x):
return x

print(get_number(5)) # Output: 25

✅ 6. Decorators on Functions with Any Inputs


Use *args and **kwargs :

python Copy code

def log(func):
def wrapper(*args, **kwargs):
print("Arguments are:", args, kwargs)
return func(*args, **kwargs)
return wrapper

@log
def multiply(a, b):
return a * b

[Link] 13/39
11/9/25, 10:31 PM Application modification


print(multiply(4, 6))

✅ 7. Real-Time Use Cases


✅ Logging
python Copy code

def logger(func):
def wrapper(*args, **kwargs):
print(f"Function {func.__name__} called")
return func(*args, **kwargs)
return wrapper

@logger
def process_data():
print("Processing...")

✅ Authentication Check
python Copy code

def check_login(func):
def wrapper(user):
if user != "admin":
print("Access Denied")
else:
return func(user)
return wrapper

@check_login
def dashboard(user):
print("Welcome Admin!")

dashboard("guest")
dashboard("admin")

[Link] 14/39
11/9/25, 10:31 PM Application modification

✅ Performance Measurement 
python Copy code

import time

def timer(func):
def wrapper():
start = [Link]()
func()
end = [Link]()
print("Time taken:", end-start)
return wrapper

@timer
def test():
for _ in range(1000000):
pass

test()

✅ 8. Decorators with Arguments (Advanced)


Decorators that accept their own arguments → requires three layers.

✅ Example: decorator that repeats a function n times:

python Copy code

def repeat(n):
def decorator(func):
def wrapper(*args, **kwargs):
for _ in range(n):
func(*args, **kwargs)
return wrapper
return decorator

@repeat(3)
def greet():
print("Hello")

[Link] 15/39
11/9/25, 10:31 PM Application modification


greet()

✅ 9. Using [Link] (Best Practice)


Without wraps , decorator hides the original function name.

python Copy code

from functools import wraps

def my_decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
return func(*args, **kwargs)
return wrapper

✅ 10. Class-Based Decorators


Decorators can also be created using classes.

✅ Example:

python Copy code

class Decorator:
def __init__(self, func):
[Link] = func

def __call__(self):
print("Before")
[Link]()
print("After")

@Decorator
def show():
print("Inside function")

show()

[Link] 16/39
11/9/25, 10:31 PM Application modification


✅ 11. Use Decorators With Methods
python Copy code

def check_role(func):
def wrapper(self):
if [Link] != "admin":
print("Not allowed")
else:
func(self)
return wrapper

class User:
def __init__(self, role):
[Link] = role

@check_role
def delete_account(self):
print("Account deleted")

u1 = User("guest")
u1.delete_account()

u2 = User("admin")
u2.delete_account()

✅ 12. Summary Table


Type Example Purpose

Basic decorator @decorator Add functionality

With arguments def wrapper(a, b) Flexibility

With [Link] @wraps(func) Preserve metadata

Decorator factory @repeat(3) Configurable

Class decorator class Decorator Advanced use

[Link] 17/39
11/9/25, 10:31 PM Application modification

Type Example Purpose 


Method decorator Inside class Role check, validation

If you want, I can provide:

✅ Decorator interview questions


✅ Decorator diagram explanation
✅ Real-world use cases (Flask, Django)

Just tell me!

give the example of decators by using simple function

Sure! Here are very simple, beginner-friendly examples of decorators using small
functions.

✅ Example 1: Simple Decorator


python Copy code

def my_decorator(func):
def wrapper():
print("Before function run")
func()
print("After function run")
return wrapper

@my_decorator
def say_hello():
print("Hello World!")

say_hello()

[Link] 18/39
11/9/25, 10:31 PM Application modification

✅ Output: 
pgsql Copy code

Before function run


Hello World!
After function run

✅ Example 2: Decorator with Arguments


python Copy code

def my_decorator(func):
def wrapper(name):
print("Calling function...")
func(name)
print("Function executed")
return wrapper

@my_decorator
def greet(name):
print(f"Hello {name}")

greet("Chandu")

✅ Output:
javascript Copy code

Calling function...
Hello Chandu
Function executed

✅ Example 3: Decorator that adds extra behavior


python Copy code

def add_feature(func):
def wrapper():
print("Start")

[Link] 19/39
11/9/25, 10:31 PM Application modification

func()

print("End")
return wrapper

@add_feature
def message():
print("This is a message")

message()

✅ Example 4: Decorator returning a value


python Copy code

def square_decorator(func):
def wrapper(num):
result = func(num)
return result * result
return wrapper

@square_decorator
def give_number(x):
return x

print(give_number(5)) # Output: 25

✅ Example 5: Decorator for simple logging


python Copy code

def logger(func):
def wrapper():
print("Function is running...")
func()
print("Function finished")
return wrapper

@logger
def demo():

[Link] 20/39
11/9/25, 10:31 PM Application modification

print("Inside demo function")


demo()

If you want **examples with user input, numbers, or with *args and kwargs, just tell
me!

in theory wise

Here is a simple, clean, theory-wise explanation of decorators that you can write in
notes or explain in an interview.

✅ Decorators – Theory Explanation


A decorator in Python is a special type of function that is used to modify or enhance
another function without changing its actual code.
It allows adding extra features to an existing function dynamically.

✅ Definition
A decorator is a function that takes another function as an argument, adds some
functionality, and returns another function.

✅ Purpose of Decorators
To add additional features to a function
To avoid repeating code
To separate logic cleanly
To maintain the original function but add extra behavior
To follow the DRY (Don’t Repeat Yourself) principle

[Link] 21/39
11/9/25, 10:31 PM Application modification

✅ How Decorators Work? 


1. A decorator wraps another function.
2. It executes some code before and/or after the original function.
3. It returns a new modified function.

✅ Syntax of Decorator
python Copy code

@decorator_name
def function_name():
pass

The @decorator_name is just another way of writing:

python Copy code

function_name = decorator_name(function_name)

✅ Components of a Decorator
A decorator contains:

1. Outer function (decorator function)


2. Inner function (wrapper)
3. Call to the original function

✅ Basic Steps in Decorator


1. Create a decorator function
2. Create a wrapper function inside it
3. Call the original function inside wrapper
4. Return wrapper function
5. Apply decorator using @decorator

✅ Types of Decorators
[Link] 22/39
11/9/25, 10:31 PM Application modification

1. Function decorators 
2. Decorators with arguments
3. Multiple decorators
4. Class decorators

✅ Advantages of Decorators
Code reuse
Clean and readable code
Adds extra functionality without modifying original function
Good for logging, authorization, validation, timing, etc.

✅ Common Applications
Logging function calls
Authentication/Authorization
Performance measurement (execution time)
Input/output validation
Debugging
Caching (in Python frameworks)

✅ Simple Example (Theory + Code)


python Copy code

def decorator(func):
def wrapper():
print("Something before function")
func()
print("Something after function")
return wrapper

@decorator
def display():
print("Hello!")

Here:

[Link] 23/39
11/9/25, 10:31 PM Application modification

decorator → decorator function 


wrapper → inner function

display → original function

✅ Summary (Short Notes)


Decorators modify behavior of functions
They wrap a function inside another function
Use @decorator_name to apply
Improve readability, reusability, and maintainability

If you want, I can prepare 2-mark, 5-mark, or 10-mark answers for exam-purpose
theory!

division of two numbers

Here are simple explanations and examples of division of two numbers.

✅ 1. Theory (Simple Explanation)


Division is a mathematical operation used to split a number into equal parts.
In Python, the division operator is:

/ → gives float result


// → gives integer (floor) result

% → gives remainder

✅ 2. Simple Python Program for Division (with input)


python Copy code

[Link] 24/39
11/9/25, 10:31 PM Application modification

a = int(input("Enter first number: "))



b = int(input("Enter second number: "))

if b != 0:
result = a / b
print("Division =", result)
else:
print("Error: Division by zero is not allowed")

✅ 3. Example Output
sql Copy code

Enter first number: 10


Enter second number: 2
Division = 5.0

✅ 4. Division using integer division


python Copy code

a = 10
b = 3
print(a // b) # Output = 3

✅ 5. Division using remainder


python Copy code

a = 10
b = 3
print(a % b) # Output = 1

If you want, I can also give division using functions, without operators, or using try-
except.
[Link] 25/39
11/9/25, 10:31 PM Application modification

by using decorator

Here is a simple, clean, beginner-friendly example of dividing two numbers using a


decorator.

✅ Division of Two Numbers Using a Decorator


✅ Theory
A decorator can be used to add extra checks—like preventing division by zero—
before executing the original division function.

✅ Code Example
python Copy code

def safe_division(func):
def wrapper(a, b):
if b == 0:
print("Error: Division by zero is not allowed!")
return None
return func(a, b)
return wrapper

@safe_division
def divide(a, b):
return a / b

# Test
print(divide(10, 2)) # Valid division
print(divide(10, 0)) # Error case

[Link] 26/39
11/9/25, 10:31 PM Application modification

✅ Output 

vbnet Copy code

5.0
Error: Division by zero is not allowed!
None

✅ Explanation
The decorator safe_division checks if the denominator ( b ) is zero.
If zero → it prints an error message.
Otherwise → it executes the divide() function normally.

If you want, I can show:

✅ Decorator with logging


✅ Decorator with input from user
✅ Decorator in class-based version

oops in python given in detiled and clearly form


including spl fumctions also

Here is a well-structured, clean, and detailed explanation of OOP in Python,


including special functions (dunder methods). This is suitable for interviews, exams,
and notes.

✅ OOPS in Python — Detailed and Clear Explanation


Object-Oriented Programming (OOP) is a programming method that organizes code
into classes and objects to achieve better structure, reusability, and modularity.
Python fully supports OOP.
[Link] 27/39
11/9/25, 10:31 PM Application modification


✅ 1. CLASS
A class is a blueprint or template for creating objects.
It defines:
Attributes (variables)
Methods (functions)

✅ Example:
python Copy code

class Student:
name = "Chandu"
age = 22

✅ 2. OBJECT
An object is an instance of a class. It has:

✅ State
✅ Behavior
✅ Identity

✅ Example:
python Copy code

s1 = Student()
print([Link])
print([Link])

✅ 3. IMPORTANT OOP FEATURES

✅ 3.1 Encapsulation
Encapsulation means wrapping data (variables) and methods (functions) together,
and controlling access.

[Link] 28/39
11/9/25, 10:31 PM Application modification

Python supports: 

Access Level Syntax Meaning

Public name Accessible everywhere

Protected _name Accessible within class and subclass

Private __name Not directly accessible

✅ Example:
python Copy code

class Employee:
def __init__(self, name, salary):
[Link] = name # public
self._dept = "IT" # protected
self.__salary = salary # private

✅ 3.2 Abstraction
Abstraction means showing only essential details and hiding unnecessary
implementation.

Implemented using abstract classes using abc module.

✅ Example:
python Copy code

from abc import ABC, abstractmethod

class Shape(ABC):
@abstractmethod
def area(self):
pass

class Square(Shape):
def area(self):
return 4*4

[Link] 29/39
11/9/25, 10:31 PM Application modification


✅ 3.3 Inheritance
Inheritance allows one class (child) to acquire methods & properties from another
(parent).

✅ Types of Inheritance:
1. Single
2. Multiple
3. Multilevel
4. Hierarchical
5. Hybrid

✅ Single Inheritance Example:


python Copy code

class A:
def showA(self):
print("A")

class B(A):
pass

obj = B()
[Link]()

✅ Multilevel Inheritance Example:


python Copy code

class A:
pass

class B(A):
pass

class C(B):
pass

[Link] 30/39
11/9/25, 10:31 PM Application modification


✅ Multiple Inheritance Example:
python Copy code

class A:
pass

class B:
pass

class C(A, B):


pass

✅ 3.4 Polymorphism
Polymorphism means same function name works differently for different objects.

✅ Method Overriding Example:


python Copy code

class Animal:
def sound(self):
print("Sound")

class Dog(Animal):
def sound(self):
print("Bark")

✅ Method Overloading (concept only)


Python does not support overloading directly, but achievable using default arguments.

python Copy code

def add(a, b, c=0):


return a + b + c

[Link] 31/39
11/9/25, 10:31 PM Application modification


✅ 4. CONSTRUCTOR
Special method created using:

python Copy code

__init__()

Called automatically when object is created.

✅ Example:
python Copy code

class Student:
def __init__(self, name):
[Link] = name

✅ 5. DESTRUCTOR
Destructor method:

python Copy code

__del__()

Called when an object is deleted.

✅ 6. TYPES OF METHODS IN PYTHON OOP


Type Decorator Purpose

Instance method None Works with object

Class method @classmethod Works with class variables

Static method @staticmethod No class/object dependency

[Link] 32/39
11/9/25, 10:31 PM Application modification

✅ Instance Method Example: 


python Copy code

class Test:
def show(self):
print("Instance method")

✅ Class Method Example:


python Copy code

class Test:
x = 10
@classmethod
def display(cls):
print(cls.x)

✅ Static Method Example:


python Copy code

class Test:
@staticmethod
def add(a, b):
return a + b

✅ 7. SPECIAL FUNCTIONS (DUnder Methods)


These are also called magic methods. They begin & end with __ .

Method Purpose

__init__() Constructor

__del__() Destructor

__str__() String representation

[Link] 33/39
11/9/25, 10:31 PM Application modification

Method Purpose 
__len__() Length

__add__() Overload + operator

__sub__() Overload - operator

__mul__() Overload * operator

__eq__() Overload == operator

__call__() Object behaves like function

__getitem__() Index access

__setitem__() Index assignment

__iter__() For iteration

✅ Example of Special Methods


python Copy code

class Number:
def __init__(self, value):
[Link] = value

def __add__(self, other):


return [Link] + [Link]

n1 = Number(10)
n2 = Number(20)

print(n1 + n2) # 30

✅ 8. OPERATOR OVERLOADING
Allows operators like + , - , * to work with objects.

Example above shows overloading using __add__() .


[Link] 34/39
11/9/25, 10:31 PM Application modification


✅ 9. CLASS VARIABLES vs INSTANCE VARIABLES
Class Variable Instance Variable

Same for all objects Different for each object

Defined outside methods Defined inside constructor

Access via [Link] Access via object

python Copy code

class Test:
class_var = 10 # class variable

def __init__(self, value):


self.instance_var = value

✅ 10. REAL-TIME OOP EXAMPLE


Bank account system:

python Copy code

class BankAccount:
def __init__(self, name, balance):
[Link] = name
self.__balance = balance # private

def deposit(self, amount):


self.__balance += amount

def withdraw(self, amount):


if amount <= self.__balance:
self.__balance -= amount

def get_balance(self):
return self.__balance

[Link] 35/39
11/9/25, 10:31 PM Application modification

✅ 11. CLASS INHERITANCE REAL USE CASE 

python Copy code

class Vehicle:
def start(self):
print("Starting...")

class Car(Vehicle):
def start(self):
print("Car Starting...")

v = Car()
[Link]()

✅ 12. POLYMORPHISM WITH FOR LOOP


python Copy code

class Cat:
def sound(self):
print("Meow")

class Dog:
def sound(self):
print("Bark")

for animal in [Cat(), Dog()]:


[Link]()

✅ 13. ENCAPSULATION REAL USE CASE


python Copy code

class Student:
def __init__(self, name):
self.__name = name

[Link] 36/39
11/9/25, 10:31 PM Application modification

def get_name(self):

return self.__name

✅ 14. ABSTRACT CLASS REAL USE CASE


python Copy code

from abc import ABC, abstractmethod

class File(ABC):
@abstractmethod
def read(self):
pass

✅ 15. CLASS-BASED DECORATOR (Advanced)


python Copy code

class Logger:
def __init__(self, func):
[Link] = func

def __call__(self):
print("Start")
[Link]()
print("End")

If you need this in:

✅ Exam answer 10-marks format


✅ Short notes
✅ PDF format
✅ With diagrams

Just tell me!

[Link] 37/39
11/9/25, 10:31 PM Application modification

import array
a = [Link]('i', [1, 2, 3, 4, 5])

[Link]()
print(*a)

why given *a at last

Here is the clear explanation 👇

✅ Why do we write *a in print(*a) ?

The * symbol is called the unpacking operator.

When you write:

python Copy code

print(*a)

it unpacks the array elements and prints them individually, separated by spaces.

✅ Without unpacking
If you write:

python Copy code

print(a)

You will get something like:

php Copy code

array('i', [5, 4, 3, 2, 1])

This prints the entire array object, not the elements.

[Link] 38/39
11/9/25, 10:31 PM Application modification

✅ With unpacking ( *a ) 
python Copy code

print(*a)

Output:

Copy code

5 4 3 2 1

Here:

*a → expands to → 5, 4, 3, 2, 1
print() prints them as separate arguments

print inserts spaces by default

✅ Example to understand unpacking


python Copy code

nums = [10, 20, 30]


print(*nums)

[Link] 39/39

You might also like