after set python.linting.mypyEnabled
to true(not to sell you have Pylance in place) you are equipped with typing
import sys
from typing import Tuple, Union
global nums
def sum2(start: int, end: int, target: int) -> Union[Tuple[int, int], None]:
seen = set()
for i in range(start, end):
n = nums[i]
if target - n in seen:
return (n, (2020 - n))
else:
seen.add(n)
return None
if __name__ == "__main__":
nums = sorted(map(int, sys.stdin))
end = len(nums)
for i, num in enumerate(nums):
ret = sum2(i, end, 2020 - num)
if ret is not None:
print(num * ret[0] * ret[1])