Write simple functions max2 and min2 that take two items


Question: Functions. In this exercise, we will be implementing the max() and min() built-in functions.

(a) Write simple functions max2() and min2() that take two items and return the larger and smaller item, respectively. They should work on arbitrary Python objects. For example, max2(4, 8) and min2(4, 8) would each return 8 and 4, respectively.

(b) Create new functions my_max() and my_min() that use your solutions in part (a) to recreate max() and min(). These functions return the largest and smallest item of non-empty sequences, respectively. Test your solutions for numbers and strings.

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Write simple functions max2 and min2 that take two items
Reference No:- TGS02580966

Expected delivery within 24 Hours