title: Getting the percentage of a variable in Python 3
body: <p>I can't seem to figure out how to get the percentage of a variable. Here's the exact assignment:</p>
  
  <blockquote>
    <p>Write a program in Python that, of a list of words stored on each line
    of a text file, prints and counts the number of long words, i.e words
    that have more than 10 characters and indicates the percentage of long
    words, given the total amountg of words in the text file.</p>
  </blockquote>
  
  <p>And here's my code:</p>
  
  <pre><code>wordcount = 0
  longwordcount = 0
  
  for line in sys.stdin:
      line = line.rstrip()
      charnum = len(line)
      wordcount = wordcount + 1
      percentage = int(longwordcount // wordcount) * 100
      if charnum &gt; 10:
           longwordcount = longwordcount + 1
           print(line)
  
  
  
  print("There are {0} words in the word list that have more than 10 characters.\nThis is {1}% of the total number of words in the text file." 
  .format(longwordcount, percentage))
  </code></pre>