Introduction to Sets

Sort by

recency

|

607 Discussions

|

  • + 0 comments

    def average(array): high = set(array) divider = len(high) val = sum(high)/divider return round(val,3)

  • + 0 comments
    def average(array):
        # your code goes here
        x = set(arr)
        return f'{(sum(x) / len(x)):.3f}'
    
  • + 0 comments

    def average(array): # your code goes here n_values = set(array) return(sum(n_values)/len(n_values))

    if name == 'main': n = int(input()) arr = list(map(int, input().split())) result = average(arr) print(result)

  • + 0 comments
    def average(array):
        # your code goes here
        unique_elements = set(array)
        return round(sum(unique_elements) / len(unique_elements), 3)
    
  • + 0 comments
    def average(array):
        distinct_h = set(array)
        avg = round(sum(distinct_h) / len(distinct_h), 3)
        return avg
    
    if __name__ == '__main__':
        n = int(input())
        arr = list(map(int, input().split()))
        result = average(arr)
        print(result)