Given a list of numbers (could be huge file with integers) , Please provide the solution to calculate the **average** of those numbers.

P.S: This question is categorized under puzzles so think twice before posting your answer

Given a list of numbers (could be huge file with integers) , Please provide the solution to calculate the **average** of those numbers.

P.S: This question is categorized under puzzles so think twice before posting your answer

val data = sc.parallelize(List.range(0,100))

val sum = data.reduce(*+*)

val avg = sum.toFloat/data.count()

2 Likes