-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathsets.py
35 lines (24 loc) · 962 Bytes
/
sets.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""
A set is an unordered collection without duplicate entries.
When printed, iterated or converted into a sequence, its elements will appear in an arbitrary order.
Example
>>> print set()
set([])
>>> print set('HackerRank')
set(['a', 'c', 'e', 'H', 'k', 'n', 'r', 'R'])
>>> print set([1,2,1,2,3,4,5,6,0,9,12,22,3])
set([0, 1, 2, 3, 4, 5, 6, 9, 12, 22])
>>> print set((1,2,3,4,5,5))
set([1, 2, 3, 4, 5])
>>> print set(set(['H','a','c','k','e','r','r','a','n','k']))
set(['a', 'c', 'r', 'e', 'H', 'k', 'n'])
>>> print set({'Hacker' : 'DOSHI', 'Rank' : 616 })
set(['Hacker', 'Rank'])
>>> print set(enumerate(['H','a','c','k','e','r','r','a','n','k']))
set([(6, 'r'), (7, 'a'), (3, 'k'), (4, 'e'), (5, 'r'), (9, 'k'), (2, 'c'), (0, 'H'), (1, 'a'), (8, 'n')])
Basically, sets are used for membership testing and eliminating duplicate entries.
"""
a = input()
b = set(map(int,raw_input().split()))
print float(sum(b))/len(b)
# print float(sum(b))/len(b)