class Task: def __init__(self, minutes: int) -> None: …
class Task: def __init__(self, minutes: int) -> None: self._minutes = mins def __lt__(self, other) -> bool: if other._minutes > self._minutes: print(“smaller”) def __repr__(self) -> str: return f”Task(minutes={self._minutes})” def main() -> None: tasks: list[Task] = [ Task(10), Task(5) ] print(sorted(tasks)) main() Answer the following: A) Find and fix AT LEAST three issues with the code above. B) What should be the type annotation on the ‘other’ parameter variable in function definition for __lt__(..) ? C) True/false, the code above once fixed will allow one to write: t1 = Task(2) t2 = Task(10) if t1 < t2: print("task 1 comes first") else: print("task 2 comes first")
Read Details