Skip to main content

Practice ยท 2 of 3

Union Return

Implement find_user(users: dict[int, str], user_id: int) -> str | None returning the name or None when absent. Annotate it โ€” get_type_hints must report the union type.

Difficulty: intermediate

Back to lesson: Practice: Annotation Drills