Search code examples
pythonmaxlis

How to find the maximum value in a list without using Built-in Functions in python?


I'd like to create a function that will print the max value within a list of numbers.


Solution

  • I dont know python but the pseudocode would look something like this

    max = –2147483648
    
    for each integer n in collection
       if n > max
          max = n
    

    It loops through every number in a collection. If the number (n) is bigger than the previous maximum, the maximum is set to be equal to n.