In this we are going to see a program of other methods of constructor in Python Programming Language.
class Student:
def __init__(self, id, name, age):
self.id = id
self.name = name
self.age = age
s = Student(2, "Abhishek", 20)
setattr(s, "id", 5)
print(getattr(s, "id"))
delattr(s, "age")
print((hasattr(s, "age")))
# Coded by Saahil
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP