i have been working on this course work i got my hands on to learn python, and i have just been working on an exercise, i was wondering if i perhaps cheated though? The exercise says the following;
write a function that takes a list of real numbers and returns both the maximum and the minimum values. Put the function in a module file with some simple test code. Make it work for positive and negative floating point numbers.
i wrote the following as a solution;
def MinMax(numbers):
''' This is a function to sort a list of real numbers,
and return the minimum and maximum values. Input a string of numbers.
'''
a = numbers
a.sort()
minimum=a[0]
maximum=a[-1]
return minimum, maximum
is it cheating to use sort() ? it does make it really easy.
sorry if this wasn't appropriate for this forum or something.
Thank you for any answers