how can i compare contents of an array and get the the max/min?? using numpy python?

my code:

temp_min_1 = file_data_object.dataTable[:13, 3]

print(temp_min_1)

output:

[-15.84, -12.24,  -8.57,  -2.43,   2.98,   7.32,   9.48,   8.5,    3.69,  -1.07,

  -9.02, -14.16, -15.71]

how do i compare each values and get the max? and min?

2 Answers

Relevance
  • 2 months ago

    The algorithm is to have a max variable and min variable then traverse the array while comparing the value read bigger than max or less than min, if bigger or less then replace the variable with the new value

  • VP
    Lv 7
    2 months ago

    Sorry, but when your instructor gives you an assignment it usually means that you've gone over that material in class and/or in the reading material. If you didn't understand how NUMPTY works you do yourself a disservice by not asking your instructor to explain it in a way that makes more sense to you.  

     

    A good programmer would pick up a PYTHON manual and look up the NUMPTY procedure/function and see how it works. In the age of Google, you can do the same thing by searching online for a Python manual. I would encourage you to always look things up on your own *before* asking for help.  The veteran programmers you may someday work with will definitely notice and appreciate your efforts. 

     

    Anyway, I'm sure some well-meaning person will arrive soon enough and write your program for you.  But rest assured, if you can't research things like this on your own, your programming career will be quite short.

Still have questions? Get your answers by asking now.