Python regular/instance method code snippets

Posted by


Hello Coders,

We have discussed the python regular or instance methods on the Youtube channel. If you go through this, you will have a clear understanding of the regular or instance method, and also it will help to crack the interviews.

Here are the code snippets of the Videos Link here.

class Student:

    def __init__(self,name, roll): = name
        self.roll = roll

    def display(self):
        print(f"name of the student: {}, roll: {self.roll}")
student_1 = Student("anil",13)

name of the student: anil, roll: 13

student_2 = Student("sanjay",15)


name of the student: sanjay, roll: 15

<bound method Student.display of <__main__.Student object at 0x000001D575390130>>
<bound method Student.display of <__main__.Student object at 0x000001D577302E50>>
student_1.display is student_2.display

Leave a Reply

Your email address will not be published. Required fields are marked *