Can u guyz help me for this problem

Write a function that given an array, returns both the minimum and maximum values in the list. Your main program should allow the user to enter space-separated numbers as test lists, until a blank line is entered.
Sample output of the program:
List: 3 6 9 2 4 6
min =2, max = 9

List:7
min =2, max = 9

List:

Help me guys

In Python you can directly use min() and max() function for this task.
or Go for iterative method:

  1. assign min = max = List[0]
  2. for each element in List:
    if element < min : min = element
    if element > max: max = element
  3. print(min,max)