I'm quite bad at formatting posts, apologies.
text = raw_input("Enter Text: ")
text_or = text
alpha = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", ",", ".", " " ]
used_li = []
used_li_count= []
var = 0
text = text.lower()
for i in alpha:
if text.count(alpha[var]) == 0:
del alpha[var]
elif text.count(alpha[var]) != 0:
print alpha[var], text.count(alpha[var])
used_li.append(alpha[var])
used_li_count.append(text.count(alpha[var]))
var = var + 1
print used_li_count
print used_li
print "Your Text Was:", text_or
When I run this, for simple words like "hello", it works just as expected. It gives me the characters used in the text and how many times they were used. My first issue is that the code doesn't recognise spacing or punctuation even though they were included in the array "alpha". The second problem is that after some point in the alphabet (somewhere near "p" and "q"), the program straight up doesn't recognise the characters. I'm a beginner at Python, so the error is probably easy to spot. Any help will be appreciated!
P.S. : What's even weirder is that when I input the whole alphabet (a to "(space)") it works like a charm. I'm even more confused now.