Parameterized Constructor in Python || Constructor || Python
In this we are going to see a program of parameterized constructor in Python Programming Language.



class Student:
    def __init__(self, id, name, age):
        self.id = id
        self.name = name
        self.age = age

    def display(self):
        print(
            f"Student details \nID = {self.id}\nName = {self.name}\nAge = {self.age} ")

s = Student(2, "Abhishek", 20)
s.display()

# Coded by Saahil


#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post