input: Write a python function to find the second largest number in an array.
  assert second_largest([3, 8, 4, 5, 7, 6]) == 7
  assert second_largest([10, 20, 30, 40, 50]) == 40
  assert second_largest([5, 5, 5, 5, 5, 5]) == 5
  assert second_largest([1, 2]) == 1
output: def second_largest(arr):
      if len(arr) < 2:
          return None
      first, second = float('-inf'), float('-inf')
      for num in arr:
          if num > first:
              second = first
              first = num
          elif first > num > second:
              second = num
      return second