This pull request introduces several dynamic programming techniques in Python, including dynamic class creation, dynamic method and attribute assignment, and dynamic property creation. Additionally, it includes test cases for each of these techniques to ensure their correct implementation.
Dynamic programming techniques:
pysnippets/DYnamic_classes/Dynamic_class.py: Added functions to dynamically create and assign functions to a class. Implemented a MathOperations class with dynamically created add and multiply methods.
pysnippets/DYnamic_classes/Property.py: Added a function to create dynamic properties in a class. Implemented a UserProfile class with dynamic name and age properties.
✅ Closes: #462
This pull request introduces several dynamic programming techniques in Python, including dynamic class creation, dynamic method and attribute assignment, and dynamic property creation. Additionally, it includes test cases for each of these techniques to ensure their correct implementation.
Dynamic programming techniques:
pysnippets/DYnamic_classes/Dynamic_class.py
: Added functions to dynamically create and assign functions to a class. Implemented aMathOperations
class with dynamically createdadd
andmultiply
methods.pysnippets/DYnamic_classes/Property.py
: Added a function to create dynamic properties in a class. Implemented aUserProfile
class with dynamicname
andage
properties.pysnippets/DYnamic_classes/attribute.py
: Added dynamic attribute assignment to a class instance through theConfig
class.pysnippets/DYnamic_classes/method.py
: Added dynamic method creation and assignment to theCalculator
class.pysnippets/DYnamic_classes/type.py
: Added dynamic class creation usingtype
, and defined aDynamicPerson
class with dynamic attributes and methods.Testing:
pysnippets/DYnamic_classes/test_Dynamic_class.py
: Added test cases for theMathOperations
class to verify the dynamically createdadd
andmultiply
methods.pysnippets/DYnamic_classes/test_property.py
: Added test cases for theUserProfile
class to verify the dynamic propertiesname
andage
.pysnippets/DYnamic_classes/test_attribute.py
: Added test cases for theConfig
class to verify dynamic attribute assignment.pysnippets/DYnamic_classes/test_method.py
: Added test cases for theCalculator
class to verify the dynamically createdadd
andsubtract
methods.pysnippets/DYnamic_classes/test_type.py
: Added test cases for theDynamicPerson
class to verify dynamic class creation and its attributes and methods.pysnippets/DYnamic_classes/test_all.py
: Created a test suite to run all the test cases together usingunittest
.TESTING
@UTSAVS26 Kindly review this PR, I request you to assign
lvl 3