In this Introduction to the problem of the set, we need to develop a python program that can read two lines that contain integers. and we need to print the average of that number on the output screen.

HackerRank Introduction to Sets solution in python

Problem solution in Python 2 programming.

n = float(raw_input())
plant = set()
sum_p = 0
for x in raw_input().split(' '):
  if x not in plant:
    sum_p += float(x)
print sum_p/float(len(plant))

Problem solution in Python 3 programming.

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

Problem solution in pypy programming.

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

Problem solution in pypy3 programming.

def average(array):
    # your code goes here
    return float(sum(x)/len(x))