About 51 results
Open links in new tab
  1. how does the python min function works - Stack Overflow

    Feb 20, 2013 · The min function returns the minimum value of an iterable according to the given key. In this case it returns the key of d with the minimum value. d.get allows you to access the …

  2. Python: min(None, x) - Stack Overflow

    If all values is None min () raise exception ValueError: min () arg is an empty sequence This code resolve this problem at all Pros: Worked if None presents in sequence Worked on Python 3 max () …

  3. The Python min() function explained, with examples

    Jun 1, 2021 · min() is a built-in function in Python 3. It returns the smallest item in an iterable, or the smallest of two or more arguments. Arguments This function takes two or more numbers or any kind …

  4. Python: Time complexity of min () function inside for loop

    Apr 12, 2022 · In the first code, it gives an array to the min () function, and this O (n) time complexity because it checks all elements in the array, in the second code, min () functions only compare two …

  5. `min()` is not working properly in Python? - Stack Overflow

    Dec 2, 2023 · Python’s min does not apply values over arrays. It gives you which it thinks is the smaller of the two arguments you pass it.

  6. python - Is it better for performance to use min () mutliple times or ...

    Jan 27, 2021 · 3 Speed It is almost always cheaper to store the result and re-use it rather than re-call the function multiple times. Python does not cache (store and later remember) results from functions like …

  7. Python Min function using key: return minimum and its value

    Nov 4, 2022 · Python Min function using key: return minimum and its value Asked 3 years, 3 months ago Modified 3 years, 3 months ago Viewed 1k times

  8. python - Getting the index of the returned max or min item using max ...

    Mar 19, 2010 · 735 I'm using Python's max and min functions on lists for a minimax algorithm, and I need the index of the value returned by max() or min(). In other words, I need to know which move …

  9. python - Find min, max, and average of a list - Stack Overflow

    I am having hard time to figure out how to find min from a list for example somelist = [1,12,2,53,23,6,17] how can I find min and max of this list with defining (def) a function I do not want to use

  10. python - Time complexity of min, max on sets - Stack Overflow

    Mar 11, 2018 · min(s) = 1 max(s) = 4 Since sets do not use indices like lists and strings, but instead operate using buckets that can be accessed directly, does the time complexity of min/max differ than …