← Back
Code Challenge 4.4 - Average Finder
Objective
Your task is to write a program that calculates the average value of a collection. You will implement a function to find the average value.
Skills to Practice
- Defining functions/methods.
- Passing arguments to functions.
- Returning values from functions.
- Iterating through collections.
Challenge Tasks
- Create a console project named Challenge 4-4.
- Define a function/method to calculate the average value of a collection.
- If you’re using a statically typed language, such as C#, you may specify either an array or a list for the parameter type.
- Example signatures:
Python
def find_average(collection):
# code here
C#
double FindAverage(int[] collection)
{
// code here
}
// -or-
double FindAverage(List<int> collection)
{
// code here
}