I am trying to write code in Python which finds the percentage of the alphabet in a given string. For example,
percent("ab", "aabccdef") should give [("a", 25), ("b", 13)] since 'a' occurs twice in a string of length 8, so its percentage is round(2 / 8), or 25.
Similarly, 'b' occurs only once. So its percentage is round(1 / 8), or 13.
Here is my code. Can someone help me debug this?
def Percent(alpha, string):
   y = [e for e in string if e == alpha]
   x = len(y)
   return (alpha, round((x / len(string) * 100)))
 
     
     
     
    