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 & MethodExercise methods ( basic )
Author
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.