← Back
Code Challenge 4.2 - Min and Max Finder
Objective
Your task is to write a program that calculates the minimum and maximum values in a collection. You will implement two separate functions: one to find the minimum value and another to find the maximum 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-2.
- Define two functions/methods: one to find the minimum value and one to find the maximum value in 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_min(collection):
# code here
C#
int FindMin(int[] collection)
{
// code here
}
// -or-
int FindMin(List<int> collection)
{
// code here
}