title: Tally votes from an input file?
body: <p>I'm trying to use python to create a program that can tally votes using an input file.</p>
  
  <p>Say the input file contains:</p>
  
  <pre class="lang-none prettyprint-override"><code>Abby 10 Bob 3
  Abby 5 Cathy 7
  Cathy 2
  Bob 1
  Abby 22
  </code></pre>
  
  <p>I would want the program to be able to tally the numbers linked to their key (the name of the candidate) and then output from highest voted for to least voted for.</p>
  
  <p>So an example output of:</p>
  
  <pre class="lang-none prettyprint-override"><code>Abby 37
  Cathy 9
  Bob 4
  </code></pre>
  
  <p>I was told I could use a looping mechanism but I am unsure how to do this in python.</p>
  
  <p>My attempt is here:</p>
  
  <p><a href="https://i.stack.imgur.com/1bn30.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1bn30.jpg" alt="screenshot of my code"></a></p>