Hey again everybody! Long time no see!
Working on text input and outputs right now. My current code is supposed to count each letter that appears in a text document (“lyrics.txt”) and output the number of times each letter appears. The gets stuck in an infinite while loop though, and I’m not entirely sure why. Thoughts?
# This program counts how often each letter appears in Taylor Swift's # "Enchanted" and prints the count to terminal # letterCounts =  * 26 # Create 26 lists with initial value of 0 inputFile = open("lyrics.txt", "r") char = inputFile.read(1) while char != "" : char = char.upper() # Converts the characters to uppercase if char >= "A" and char <= "Z" : # Makes sure the character is a letter code = ord(char) - ord("A") letterCounts[code] = letterCounts[code] + 1 for i in range(26) : char = chr(i + 65) print("%-4s%5d" % (char, letterCounts[i])) inputFile.close()```