## Sunday, October 11, 2020

Solution Exercise 201: python program that search the minmum and maximum for a given set #### Exercise 201

Write a python program as a function that determines the minimum and maximum values of given a set withowt using any predefined function. Example if
``E = {13 , 2 , 47 , 23 , 71 , 17}``
, the function returns (2,71)

#### Solution

``````def minMax(E):
# converting the set to a list
L = list(E)
# initialising the maximum and minimum
M = L
m = L
for x in L:
if x < m :
m = x
for x in L:
if M < x:
M = x
return (m , M)

# Testing algorithm
E = E = {13 , 2 , 47 , 23 , 71 , 17}
print("(minimum , maximum) = " , minMax(E))
# The output is : (minimum , maximum) =  (2, 71)``````

Younes Derfoufi
my-courses.net

## Python Exercises With Solutions

1. Python Arithmetic Exercises
2. Equations & System Of Equations
3. Polynomials and Functions
4. Python Arithmetic Exercises
5. Numpy, Matplolib, Sympy , Scipy - Exercises
6. Python Arithmetic Exercises

Younes Derfoufi

## Sample Text 