LearnPy Hub
← Decorators problems
Hard

Class Decorator

Write a decorator that adds a method describe() to a class, returning ClassName with N attributes (counting instance attributes). Apply it to a class Point(x, y) and Student(name, dept, cgpa). Print describe() for the class named in the input.

Input

Point or Student.

Output

One line.

Sample 1

Input
Point
Output
Point with 2 attributes

Sample 2

Input
Student
Output
Student with 3 attributes
solution.py
Output appears here
Class Decorator · Python practice problem · LearnPy Hub