Visit Sikshapath For More Info
Visit Sikshapath For More Info
CODE:
class Student:
student_id = 'V10'
student_name = 'James'
if not attr.startswith('_'):
print("\nAfter adding the student_class, attributes and their values with the said
class:")
Student.student_class = 'V'
if not attr.startswith('_'):
print("\nAfter removing the student_name, attributes and their values from the
said class:")
del Student.student_name
if not attr.startswith('_'):
OUTPUT:
CODE:
class pair:
lookup[num] = i
OUTPUT:
CODE:
class Rectangle():
rec.length = a
def rectangle_area(rec):
return rec.length*rec.width
print(“Area : ”,newRectangle.rectangle_area())
OUTPUT:
CODE:
class Circle():
cir.radius = r
def area(cir):
return cir.radius**2*3.14
def perimeter(cir):
return 2*cir.radius*3.14
NewCircle = Circle(8)
print("Area : ",NewCircle.area())
print("Perimeter : ",NewCircle.perimeter())
OUTPUT:
CODE:
class Student:
pass
class Marks:
pass
student1 = Student()
marks1 = Marks()
print(isinstance(student1, Student))
print(isinstance(marks1, Student))
print(isinstance(marks1, Marks))
print(isinstance(student1, Marks))
print("\nCheck whether the said classes are subclasses of the built-in object
class or not.")
print(issubclass(Student, object))
print(issubclass(Marks, object))
OUTPUT: