Min/Max Templates Write templates for the two functions min and max. min should accept two arguments and return the value of the argument that is the lesser of the two. max should accept two arguments and return the value of the argument that is the greater of the two. Design a simple driver program that demonstrates the templates with various data types.

Respuesta :

Answer:

x = int(input('Enter First value'))

y = int(input('Enter Second value'))

def minimum(x,y):

 diff = min(x,y)

 print('The minimum value is ' + str(diff))

def maximum(x,y):

 diff = max(x,y)

 print('The maximum value is ' + str(diff))

func_dict = {'maximum':maximum, 'minimum': minimum}

if __name__ == "__main__":

   command = input("> ")

   func_dict[command](x,y)

Explanation:

Asked user to input two values.

and than ask the user to select either to find maximum value or minimum value.

When user will type maximum or minimum the same function will be called and print the answer

ACCESS MORE
EDU ACCESS