Introduction to Sets

Sort by

recency

|

613 Discussions

|

  • + 0 comments

    def average(array): import statistics height = set(array) avg = statistics.mean(height) return avg # your code goes here

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

  • + 0 comments
    return sum(set(array))/len(set(array))
    
  • + 0 comments

    def average(array): new_array = set(array) avg = sum(new_array)/len(new_array) rounded = round(avg,3) return rounded

  • [deleted]Challenge Author
    + 0 comments

    For Python3

    def average(array):
        return sum(set(array))/len(set(array))
    
    if __name__ == '__main__':
        n = int(input())
        arr = list(map(int, input().split()))
        result = average(arr)
        print(result)
    
  • + 0 comments

    code

    def average(array): return sum(set(array)) / len(set(array))