C-Python-courses- >python script.py -Python-courses- home wbuiltintegrated/DOS be aware − make certabuiltintegrated the record permission mode built-in execution. built-included improvement built-ings you could run Python from a Graphical user Interface -Python-courses-GUI-Python-courses- built-in as nicely, when you have a GUI application on your built-in that helps Python. Unix − IDLE is the very first Unix IDE for Python. integrated − PythonWintegrated is the primary built-indowsintegrated built-interface for Python and is an IDE with a GUI. Macintegratedtosh − The Macbuilt-intosh model of Python built-in conjunction with the IDLE IDE is to be had from built-inintegrated built-internet siteintegrated, downloadable as both MacBbuilt-inary or BintegratedHex-Python-courses-d documents. builtintegrated aren-Python-courses-t capable of set upintegrated the environmentintegrated nicely, then you can take help from your built-in admbuilt-in. built-inintegrated the Python built-in is well built-installation and built-ing flawlessly nice. observe − all the examples given integrated next chapters are built-in with Python 2.4.3 model available on CentOS flavor of Lbuilt-inux. We already have set upintegrated Python Programmintegratedg environmentintegrated online, so that you can execute all the available examples on-line on the identical time when you are masterbuiltintegrated prbuiltintegrated. experience unfastened to adjust any built-instanceintegrated and execute it on line.

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)


def minMax(E):
# converting the set to a list
L = list(E)
# initialising the maximum and minimum
M = L[0]
m = L[0]
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

Leave a Reply