Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

5. (15 pts) Find the maximum and minimum elements in a list Given a list A, the

ID: 3873607 • Letter: 5

Question

5. (15 pts) Find the maximum and minimum elements in a list Given a list A, the max function in Python's standard library computes the largest element in A: max(A). Similarly, min(A) returns the smallest element in A. Write your own max and min functions. Hint Initialize a variable max elem by the first element in the list, then visit all the remaining elements (A[1:]), compare each element to max_elem, and if greater, set max_elem equal to that element. Use a similar technique to compute the minimum element. 6. (30 pts) Simulate nested loops by hand

Explanation / Answer

1 Let A be an array and we are finding maximum and minimum of elements in array A. code is as below

for minimum:-

2. maximum function code:-

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote