• How can one split code into two function in python

 

It gives error if i define function out or even in the scope defined for tests...

NameError: name 'findMinMax' is not defined

def find_min_max(data: set[int]) -> list[int]|None:
    if(data.length == 0):
        pass
    return [min(data), max(data)]

def remove_min_max(data: set[int], total: int) -> set[int]:    
    for i in range(total):
        min_max = findMinMax(data)  # NameError: name 'findMinMax' is not defined
    ....