Question: 2. Write your own versions of the Python min and max functions. They should take a list as an argument and return the minimum

2. Write your own versions of the Python min and max functions.

2. Write your own versions of the Python min and max functions. They should take a list as an argument and return the minimum value for the min function and the maximum value for the max function from the list passed in to each. Hint: Pick the first element as the minimum or maximum and then loop through the elements to find smaller or larger values. Each time you find a smaller or larger value update your minimum or maximum. After completely iterating through the list return the min or the max value. Test Data: [1, 7, 9, 2, 5, 18, 0, 2, 57, 33, 8]

Step by Step Solution

3.44 Rating (151 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

2 Python version 36 Python program to create and implement functions that returns minimum and maximu... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!