title: Printing character percent in a text file
body: <p>I just wrote a function which prints character percent in a text file. However, I got a problem. My program is counting uppercase characters as a different character and also counting spaces. That's why the result is wrong. How can i fix this?</p>
  
  <pre><code>def count_char(text, char):
      count = 0
      for character in text:
          if character == char:
              count += 1
      return count
  
  filename = input("Enter the file name: ")
  with open(filename) as file:
      text = file.read()
  
  for char in "abcdefghijklmnopqrstuvwxyz":
      perc = 100 * count_char(text, char) / len(text)
      print("{0} - {1}%".format(char, round(perc, 2)))
  </code></pre>