Average of a set
Write a Python program to find the average of the elements of a set.
{4, 8, 15, 16, 23, 42}18.0
Approach
sum / len.
Solution
s = {4, 8, 15, 16, 23, 42}print(sum(s) / len(s))18.0
Learn the concept
New to this topic? Read the lesson, then come back.