About 424 results
Open links in new tab
  1. Creating a max function from scratch (python) - Stack Overflow

    Jul 27, 2016 · So I'm trying to create a function that determines the maximum of a set of values, from scratch. I'm not sure how to make the function change the new value of Max after a new Max has been found, I'm also not sure if my usage of args is correct. Max = 0. for item in List: if item > Max: item = Max. return Max. Any help would be hugely appreciated.

  2. Finding the source code for built-in Python functions?

    Since Python is open source you can read the source code. To find out what file a particular module or function is implemented in you can usually print the __file__ attribute. Alternatively, you may use the inspect module, see the section Retrieving Source Code in the documentation of …

  3. Implementation of the max() function in Python - Stack Overflow

    Nov 17, 2021 · Short answer: Use a star to collect the arguments in a tuple and then add a special case for a tuple of length one to handle a single iterable argument. Source material: The C code that handles the logic can be found at: https://github.com/python/cpython/blob/da20d7401de97b425897d3069f71f77b039eb16f/Python/bltinmodule.c#L1708.

    Missing:

    • Source Code

    Must include:

  4. Python - max() function - GeeksforGeeks

    Nov 30, 2023 · We can use max () function to locate the largest item in Python. Below are some examples: The code initializes three variables with values (var1 = 4, var2 = 8, var3 = 2) and then finds the maximum value among them using the max() function. The result, that is …

  5. Type annotated pure python implementation of the builtin max() function

    max (arg1, arg2, *args, * [, key=func]) -> value With a single iterable argument, return its biggest item. The default keyword-only argument specifies an object to return if the provided iterable is …

  6. Max function implementation explained in Python · GitHub

    Oct 14, 2023 · # Input data list_0 = [1, 3, 6, 7, 8, 9, 10, 2, 3, 4] list_1 = [12, 56, 3, 78, 34, 56, 2, 10] list_2 = [123, 567, 234, 890] list_3 = [5, 7, 8, 9, 3, -2, -4, -2, 5, 6, 8, 11, 2] # Iterative algorithm …

  7. max () | Python’s Built-in Functions – Real Python

    In this tutorial, you'll learn how to use Python's built-in min () and max () functions to find the smallest and largest values. You'll also learn how to modify their standard behavior by providing a suitable key function. Finally, you'll code a few practical examples of using min () and max ().

  8. Python's min () and max (): Find Smallest and Largest Values

    In this tutorial, you'll learn how to use Python's built-in min () and max () functions to find the smallest and largest values. You'll also learn how to modify their standard behavior by providing a suitable key function. Finally, you'll code a few practical examples of using min () and max ().

  9. Python max () Function - W3Schools

    The max() function returns the item with the highest value, or the item with the highest value in an iterable. If the values are strings, an alphabetically comparison is done.

  10. max () in Python - Built-In Functions with Examples

    The max() function in Python is a built-in function that returns the highest value among the arguments passed to it. It can take multiple arguments or an iterable (such as a list, tuple, or set) and return the maximum value present in them based on their comparison order.

  11. Some results have been removed
Refresh