正解:A
Python classes are a fundamental aspect of object-oriented programming (OOP) in Python. They offer several benefits:
* Improved Code Organization: Classes bundle data (attributes) and functionality (methods) together. This encapsulation helps keep related parts of the code together, making it easier to understand and manage.
* Reusability and Inheritance: Classes support inheritance, allowing the creation of new classes based on existing ones. This promotes code reuse and can lead to a more logical structure.
* Modularity: By using classes, you can create modules that encapsulate specific functionalities, making the code modular and easier to maintain.
* Encapsulation and Abstraction: Classes allow for encapsulating data and functionality, providing a clear structure and abstraction layers, which enhance code readability and maintainability.
References:
* Python Classes and Objects - W3Schools
* Python Documentation on Classes