Introduction to Sets

  • + 0 comments
    def average(arr):
        # Use a set to ensure unique heights
        unique_heights = set(arr)
        
        # Compute and return the average rounded to three decimals
        return round(sum(unique_heights) / len(unique_heights), 3)