Complete the code to define a class with clear responsibilities.
class User [1]: def __init__(self, name): self.name = name
The class represents an entity with a clear responsibility, which helps keep code clean.
Complete the code to add a method that follows single responsibility principle.
class Calculator: def [1](self, a, b): return a + b
The method name 'add_numbers' clearly describes its single responsibility, aiding clean code.
Fix the error in the method that violates clean code principles.
def process_data(data): result = [] for item in data: if item > 0: result.append(item) return [1]
The function should return the filtered list 'result' to keep code clean and functional.
Fill both blanks to create a clean function that separates concerns.
def [1](data): filtered = [x for x in data if x [2] 0] return filtered
The function name 'filter_positive' clearly states its purpose and uses '>' to filter positive numbers, following clean code principles.
Fill all three blanks to implement a clean class method that modifies state safely.
class Counter: def __init__(self): self.count = 0 def [1](self): self.count [2] 1 return self.[3]
The method 'increment' clearly describes its action, uses '+=' to increase count, and returns the updated 'count' attribute, following clean code practices.