Move History

Fork Selected
  • Code
    def find_max(arr):
        max = 0
        for i in range(len(arr)):
            if arr[i] > max:
                max = arr[i]
        return max
    Test Cases
    # TODO: Replace examples and use TDD by writing your own tests
    # These are some of the methods available:
    #   test.expect(boolean, [optional] message)
    #   test.assert_equals(actual, expected, [optional] message)
    #   test.assert_not_equals(actual, expected, [optional] message)
    
    # You can use Test.describe and Test.it to write BDD style test groupings
    test.assert_equals(find_max([1, 2, 3, 4, 5]), 5)
  • Code
    • def find_max(arr):
    • return 0
    • max = 0
    • for i in range(len(arr)):
    • if arr[i] > max:
    • max = arr[i]
    • return max