class student_kit():
def __init__(self,name):
self.name=name
print("Welcome",self.name)
kalu=student_kit("Kalu")
Output
Welcome Kalu
class student_kit():
def __init__(self,name):
self.name=name
print("Welcome",self.name)
def section(self,s1):
self.section_name=s1 #instance attribute
kalu=student_kit("Kalu") # object declaration
kalu.section('A') # using section method
print(kalu.section_name) # object accessing instance attribute
print(kalu.section_name) # instant attribute
print(kalu.section('A') # method
Tutorial on Class Object & Method
Exercise methods ( basic )
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.