The Assignments excerpts present a variety of programming assignments focused on building practical skills in Object-Oriented Programming (OOP) using Python. Here's a breakdown of the assignment types:
- Number Sequence Generation: Create generator functions to produce sequences of numbers like squares, palindromes, even numbers, powers of two, and prime numbers up to a given limit.
- Lambda Function Applications: Use lambda functions for tasks like calculating sums, squares, checking even/odd numbers, concatenating strings, and finding maximum values.
- List Processing: Implement functions to process lists, extracting squares of even numbers, calculating products or sums of specific elements, doubling odd numbers, and filtering out prime numbers.
- Define class hierarchies demonstrating inheritance, for example, an Animal class with a Dog subclass, and override methods like make_sound to exhibit polymorphic behavior.
- Explore multiple inheritance by creating classes like Mammal and DogMammal inheriting from multiple parent classes.
- Implement constructors in classes with varying initialization parameters.
- Create classes with static methods, such as a Calculator class with a add method, an Employee class with a get_employee_count method, and similar examples for string formatting, circle area calculation, and temperature conversion.
- Utilize special methods like str, len, add, getitem, iter, and next to customize the behavior of your classes and their instances.
- Implement property decorators to define getter, setter, and deleter methods for controlled access and modification of attributes within classes like BankAccount and Person.
- Create decorator functions to add functionalities to other functions, such as printing messages before and after execution, accepting and passing arguments, and preserving metadata.