SoFunction
Updated on 2025-03-02

Python custom function to implement maximum output method

The built-in max() function in python is used to get the maximum value, and it is also possible to sort through bubbles.

#!/usr/bin/python
 
def getMax(arr):
  for i in range(0,len(arr)):
    for j in range(i+1,len(arr)):
      first=int(arr[i])
      second=int(arr[j])
      if first<second:
        arr[i]=arr[j]
        arr[j]=first
  print arr[0]
 
arr1=[19,29,30,48]
getMax(arr1)

The above method of outputting the maximum value of python custom functions is all the content I share with you. I hope you can give you a reference and I hope you can support me more.