In this **HackerRank Introduction to sets problem solution in python**, 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.

## 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: plant.add(x) 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 x=set(array) return float(sum(x)/len(x))

## 0 Comments