I'm new to Python, and am attempting to create a frequency analysis program, which is a program that tells you how often letters occur in a text. I made each letter in the alphabet a variable, all within a function named 'freq_analysis' that uses the parameter 'text', so they could all be printed and calculated separately, and each variable looked like this:
a = text.count('a' and 'A')
Each variable was identical to that. Other than the letter being different, that is. I made sure that there were no backticks or spaces mixed with tabs on each line. I then created separate variables where the percentages (how often each letter occured in the text) were calculated, which looked like this:
aa = (a / (len(text) - blank)) * 100
Again, I checked that each variable was identical. The problem is that when I try to print each percentage, the only percentage that's calculated and printed is that of the letter T. This doesn't even include lowercase t, it's only the capital T. I tested this by calling on the function and running the text 'tttTtt' through it. The percentage 16.66 was returned, rather than 100, which is what it should have been. I'm printing each letter using this code:
print (aa,'%')
If I wasn't clear enough, I can provide more information, because I have no idea as to what the problem is.