Complete the code to identify the principle that encourages breaking a program into smaller parts.
The principle of [1] suggests dividing software into smaller, manageable pieces.Modularity means breaking a program into smaller parts or modules that can be developed and tested independently.
Complete the code to name the principle that hides internal details from the user.
The principle of [1] protects data by hiding internal details and exposing only necessary parts.
Encapsulation means hiding the internal state and requiring all interaction to be performed through an object's methods.
Fix the error in naming the principle that allows objects to take many forms.
The principle of [1] allows objects to be treated as instances of their parent class or their own class.
Polymorphism allows objects to be accessed through references of their parent class, enabling different behaviors.
Fill both blanks to complete the principle that measures how strongly components depend on each other.
Low [1] and high [2] are desired for good software design.
Coupling measures dependency between modules; low coupling means less dependency. Cohesion measures how closely related the functions within a module are; high cohesion is better.
Fill all three blanks to complete the dictionary comprehension that filters principles by importance and formats keys.
filtered = [1]: [2] for [3], importance in principles.items() if importance > 7
This comprehension creates a new dictionary with keys as principle names and values as their importance, but only includes those with importance greater than 7.