title: Calculating the percent using a for loop
body: <p>I am having trouble figuring out how to calculate the percent of certain letters within an input using a "for loop". I want to calculate the amount of X's and Y's a string has, and have the output come out as a percent but I want to use a "for loop" for it. </p>
  
  <p>This is what I was able to do so far: </p>
  
  <pre><code>def percent(string):
      counter = 0
      for stuff in string:
          if "X" in string:
              counter = counter + 1
          if "Y" in string:
              counter = counter + 1
              XY_percent = (counter / len(string)) * 100
      return "{}%".format(int(XY_percent))
  </code></pre>
  
  <p>I only want to use "for loops" for this. </p>