Middle
Can you give a micro-example of a task — a specific scenario?
sobes.tech AI
Answer from AI
Example micro-task: write a function that takes a list of numbers and returns a new list where each number is squared, but only if it is even.
This is a simple scenario that can be used for practicing data filtering and transformation.
Example in Python:
def square_even_numbers(numbers):
return [x**2 for x in numbers if x % 2 == 0]
# Example usage
print(square_even_numbers([1, 2, 3, 4, 5])) # Outputs [4, 16]