is my code still salvageable? Here's a snippet of me trying to find the amount of times a letter in the alphabet (both upper and lower case) shows up in a text paragraph. This code successfully works for making two separate lists of lower and upper case letters, but I'm trying to merge them into one. I thought I could input a def merge() but it didn't work and I have a feeling I might have to start completely over.
small_letter_status = [0]*26
capital_letter_status = [0]*26
for x in txt:
if x>='a' and x<='z':
small_letter_status[ord(x)%ord('a')] += 1
elif x>='A' and x<='Z':
capital_letter_status[ord(x)%ord('A')] += 1
print("\nSmall Letter count")
for x in range(len(small_letter_status)):
print(chr(x+(ord('a'))), small_letter_status[x])
print("\nCapital Letter count")
for x in range(len(capital_letter_status)):
print(chr(x+(ord('A'))), capital_letter_status[x])