output_description: For each dataset, select two students with the smallest difference in their
  scores, and output in a line (the absolute value of) the difference.
input_description: The input consists of multiple datasets, each in the following format.
  
  _n_  
  _a_ 1 _a_ 2 … _a n_
  
  A dataset consists of two lines. The number of students _n_ is given in the
  first line. _n_ is an integer satisfying 2 ≤ _n_ ≤ 1000\. The second line
  gives scores of _n_ students. _a i_ (1 ≤ _i_ ≤ _n_) is the score of the _i_
  -th student, which is a non-negative integer not greater than 1,000,000.
  
  The end of the input is indicated by a line containing a zero. The sum of _n_
  's of all the datasets does not exceed 50,000.
attempt: def main():
      while True:
          s_num = int(input())
  
          if s_num == 0:
              return
  
          s_dat = input()
          s_dat = s_dat.split(" ")
  
          for j in range(len(s_dat)):
              s_dat[j] = int(s_dat[j])
  
          s_dat.sort()
  
          answer = sa(s_dat)
          print(answer)
  
  
  def sa(array):
      min_dist = 1000000 + 1
  
      for i in range(len(array) - 1):
          dist = array[i + 1] - array[i]
  
          if dist <= min_dist:
              min_dist = dist
  
      return min_dist
  
  
  main()
  
problem_description: Selection of Participants of an Experiment
  
  Dr. Tsukuba has devised a new method of programming training. In order to
  evaluate the effectiveness of this method, he plans to carry out a control
  experiment. Having two students as the participants of the experiment, one of
  them will be trained under the conventional method and the other under his new
  method. Comparing the final scores of these two, he will be able to judge the
  effectiveness of his method.
  
  It is important to select two students having the closest possible scores, for
  making the comparison fair. He has a list of the scores of all students who
  can participate in the experiment. You are asked to write a program which
  selects two of them having the smallest difference in their scores.
samples: [{"input": "10 10 10 10 10\n    5\n    1 5 8 9 11\n    7\n    11 34 83 47 59 29 70\n    0", "output": "1\n    5"}]