title: How do you find percentile for the values of a dictionary in python
body: <p>I'm given the following question and have been asked not to use numpy and pandas.</p>
  
  <p>Consider the marks list of class students given in two lists </p>
  
  <pre><code>Students =['student1','student2','student3','student4','student5','student6','student7','student8','student9','student10'] 
  
  Marks = [45, 78, 12, 14, 48, 43, 45, 98, 35, 80] 
  </code></pre>
  
  <p>from the above two lists the <code>Student[0]</code> got <code>Marks[0]</code>, <code>Student[1]</code> got <code>Marks[1]</code> and so on. </p>
  
  <p>So task is to print the name of students</p>
  
  <ul>
  <li>Who got top 5 ranks, in the descending order of marks </li>
  <li>Who got least 5 ranks, in the increasing order of marks</li>
  <li>Who got marks between >25th percentile &lt;75th percentile, in the increasing order of marks.</li>
  </ul>
  
  <p>For the first two questions, I created a dictionary of both the lists with students as keys and marks as values, I then sorted the ascending and descendingly based on the values, however, I'm getting the entire ascending and desceding list, how do I limit my top 5 results (Like LIMIT 5 in mysql lol)</p>
  
  <p>Also, I'm clueless on how to tackle the 3rd question, can you please help me ?</p>
  
  <p>Please find my code below</p>
  
  <pre><code>Students=['student1','student2','student3','student4','student5','student6','student7','student8','student9','student10']
  
  Marks = [45, 78, 12, 14, 48, 43, 47, 98, 35, 80]
  
  def display_dash_board(students, marks):
  
      dictionary = dict(zip(Students,Marks))
  
      print('top_5_students')
  
      for key, value in sorted(dictionary.items(), key=lambda item: item[1],reverse=True):
            print("%s: %s" % (key, value))
  
  #this is giving me the entire descending list (not python list) of all 10 students how to limit to five?
  
  
      print('least_5_students')
  
      for key, value in sorted(dictionary.items(), key=lambda item: item[1]):
            print("%s: %s" % (key, value))
  
      #this is giving me the entire ascending list (not python list) of all 10 students how to limit to five?   
  
      # How to go about the percentile question ?
  
  display_dash_board(Students, Marks)
  </code></pre>