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
|
646 Discussions
|
Please Login in order to post a comment
def average(arr): distinct=set(arr) avg=sum(distinct)/len(distinct) result=f"{avg:.3f}" return result
if name == 'main': n = int(input()) arr = list(map(int, input().split())) result = average(arr) print(result)
def average(array): array=sum(set(arr))/len(set(arr)) return array
For Python3 Platform
def average(array): # your code goes here distinct = set(array) average = round(sum(distinct)/len(distinct),3) return average
if name == 'main': n = int(input()) arr = list(map(int, input().split())) result = average(arr) print(result)