Second largest distinct value
Your task
Given a list of integers nums, return the second largest distinct value. If there is no second distinct value (the list is empty or every element is equal), return None. Example: [3, 1, 3, 2] has distinct values {1,2,3}, so the answer is 2.
Examples
second_largest(nums: list[int]) -> int | NoneExample 1
Input
second_largest([3, 1, 3, 2])Output
2