We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Sets
- Introduction to Sets
- Discussions
Introduction to Sets
Introduction to Sets
Sort by
recency
|
613 Discussions
|
Please Login in order to post a comment
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)
def average(array): new_array = set(array) avg = sum(new_array)/len(new_array) rounded = round(avg,3) return rounded
For Python3
code
def average(array): return sum(set(array)) / len(set(array))