Answers for "create instance in python\"

1

instance method in python

# Instance Method Example in Python 
class Student:
    
    def __init__(self, a, b):
        self.a = a
        self.b = b 
    
    def avg(self):
        return (self.a + self.b) / 2

s1 = Student(10, 20)
print( s1.avg() )
Posted by: Guest on August-12-2020

Code answers related to "create instance in python\"

Python Answers by Framework

Browse Popular Code Answers by Language