User FAQs


1) Is Python an Object Orientated programming language ?
Yes it is an interpreted and object orientated. It also supports procedural and functional programming
Python supports object-orientated programming as you can define classes along with the composition and inheritance.


2) What is Inheritance in Python?
Inheritance allows us to define a class that inherits all the methods and properties from another class.
Parent class is the class being inherited from, also called base class.
Child class is the class that inherits from another class, also called derived class.


3) What is a class in Python, and how do you use it?
A Class is like an object constructor, or a "blueprint" for creating objects.
You can create a class with the class keyword:

class MyClass: 
x = 5

Now we can use the class named MyClass to create objects:


4) Create an object named p1, and print the value of x:

p1 = MyClass() 
print(p1.x)

5) What are Access Specifiers ?
Python uses the '_' symbol to determine the access control for a specific data member or a member function of a class. A Class in Python has three types of Python access modifiers:
Public Access Modifier: The members of a class that are declared public are easily accessible from any part of the program. All data members and member functions of a class are public by default.
Protected Access Modifier: The members of a class that are declared protected are only accessible to a class derived from it. All data members of a class are declared protected by adding a single underscore '_' symbol before the data members of that class.
Private Access Modifier: The members of a class that are declared private are accessible within the class only, the private access modifier is the most secure access modifier. Data members of a class are declared private by adding a double underscore '__' symbol before the data member of that class.


6) What is the __init__() function in Python?
All classes in Python have a function called __init__(), which is always executed when the class is being initiated.
We can use the __init__() function to assign values to object properties, or other operations that are necessary to do when the object is being created.
__init__() is Python's equivalent of constructors in OOP, called automatically when a new object is created. It initializes the object's attributes with values but doesn't handle memory allocation.
Memory allocation is handled by the __new__() method, which is called before __init__().
The self parameter in __init__() refers to the instance of the class, allowing access to its attributes and methods.
self must be the first parameter in all instance methods, including __init__()

class MyClass: 
    def __init__(self, value):
        self.value = value # Initialize object attribute

    def display(self):
        print(f"Value: {self.value}")

obj = MyClass(10)
obj.display()


7) What is the difference between @classmethod, @staticmethod and instance methods ?
Instance Method operates on an instance of the class and has access to instance attributes and takes self as the first parameter

def method(self): 

Class Method directly operates on the class itself and not on instance, it takes cls as the first parameter and defined with @classmethod.

@classmethod def method(cls): 

Static Method does not operate on an instance or the class and takes no self or cls as an argument and is defined with @staticmethod.
align it and dont bolod anything and not bullet points

@staticmethod def method() 


© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext