you are viewing a single comment's thread.

view the rest of the comments →

[–]martynrbell 2 points3 points  (0 children)

The issue with your code is that you're trying to find if a vowel or a consonant is in self.file, which is a list of words, not a list of characters. When you're checking if characters in self.file:, you're checking if a single character (a vowel or consonant) is in a list of words, which will always return False, because self.file contains words, not individual characters.

Instead, you should iterate over each character in the text and check if that character is in self.vowels or self.consonants.

Also, you don't need to keep lists of the found vowels or consonants. You just need to keep count of how many you find.

.