title: python program for a book issuing process
body: <p>For a library book issuing process i consider the following info
  Information about books
  Line format: Accession Number~Title</p>
  
  <p>Information about borrowers
  Line format: Username~Full Name</p>
  
  <p>Information about checkouts
  Line format: Username~Accession Number~Due Date</p>
  
  <p>I am trying to write a Python program to read the data as described above and print out details about books that have been checked out. Each line should describe to one currently issued book in the following format:</p>
  
  <p><strong>Due Date~Full Name~Accession Number~Title</strong>
  <em>The output should be sorted in increasing order of due date. For books due on the same date, sort in increasing order of full name.</em></p>
  
  <p>Here is a sample input and its corresponding output.
  <strong>Sample Input</strong></p>
  
  <p>Books
  APM-001~Advanced Potion-Making
  GWG-001~Gadding With Ghouls
  APM-002~Advanced Potion-Making
  DMT-001~Defensive Magical Theory
  DMT-003~Defensive Magical Theory
  GWG-002~Gadding With Ghouls
  DMT-002~Defensive Magical Theory
  Borrowers
  SLY2301~Hannah Abbott
  SLY2302~Euan Abercrombie
  SLY2303~Stewart Ackerley
  SLY2304~Bertram Aubrey
  SLY2305~Avery
  SLY2306~Malcolm Baddock
  SLY2307~Marcus Belby
  SLY2308~Katie Bell
  SLY2309~Sirius Orion Black
  Checkouts
  SLY2304~DMT-002~2019-03-27
  SLY2301~GWG-001~2019-03-27
  SLY2308~APM-002~2019-03-14
  SLY2303~DMT-001~2019-04-03
  SLY2301~GWG-002~2019-04-03
  EndOfInput</p>
  
  <p><strong>Sample Output</strong></p>
  
  <p>2019-03-14~Katie Bell~APM-002~Advanced Potion-Making
  2019-03-27~Bertram Aubrey~DMT-002~Defensive Magical Theory
  2019-03-27~Hannah Abbott~GWG-001~Gadding With Ghouls
  2019-04-03~Hannah Abbott~GWG-002~Gadding With Ghouls
  2019-04-03~Stewart Ackerley~DMT-001~Defensive Magical Theory</p>
  
  <pre><code>def inp_borrower(l):
  x=input()
  while x!='Checkouts':
      x=x.split('~')
      x.append(0)    
      l.append(x)
      x=input()
  
  def inp_books(checkout):
  x=input()
  while x!='EndOfInput':
      x=x.split('~')
      x=x[len(x)-2:]
      grade.append(x)
      x=input()
  def checkout(x):
  if x=='EndOfInput':
      return map(lambda x:x[1], sorted(map(lambda a:[map(int,a.split('-')),a], timestamps)))
  def cal():
  global li,grade
  for i in li:   # i is a list containg the name and roll of a student
      j=0
      sum=0
      while j&lt;len(grade):
          if i[0]==grade[j][0] :     # if the roll matchs
              sum=sum+com(grade[j][1])
              grade.pop(j)
              i[2]+=1
          else :
              j+=1
      if sum!=0 :
          i[2]=round(sum/i[2],2)
      print(i[0]+'~'+i[1]+'~',i[2],sep='')
  li=[]             
  grade=[]
  x=input()
  while x!='borrower':          
  x=input()
  stu_input(li)
  li.sort()
  inp_grade(grade)
  cal()
  </code></pre>
  
  <p>I'd appreciate any help and advice! Please take into consideration I am really new to this stuff. I'm also not quite sure on having a function inside of a function.</p>
  
  <p>Thanks in advance!</p>