Python program that extracts all the words with 10 constonants

Hey guys!

Does anyone have a Python3 program that can extract only the words with 10 constonants from a txt file?

This is what I have until now:

import sys

def main():
   vowel = ['a','e','i','o','u']
vowel_count = 0
for line in sys.stdin:
	line = line.rstrip()
	for char in line:
		if char == vowel:
			vowel_count = vowel_count + 1
			
	constonant_count = total_length_line - vowel_count
	if constonant_count == 10:
		print(line)

main()

It doenst work however.

Can you provide more detail on how it isn’t working?

As with your other thread, if we do all the work for you how will you learn anything? :slight_smile:

Thanks for the reply!

import sys

def main():
    vowel = ['a','e','i','o','u']
    vowel_count = 0
    constonant = [ 'b','c','d','j','f','g','h','k','l','m','n','p','q','r','s','t','v','w','x','y','z']
    for line in sys.stdin:
    	    line = line.rstrip()
	    total_length_line = len(line)
	    for char in line:
		    if char == vowel:
			vowel_count = vowel_count + 1
			
	constonant_count = total_length_line - len(vowel)
	if constonant_count == 11:
		print(line)

main()

This is what I have until now and this works, but when I print it, it only prints one of three words that need to be printed from my list. Any tups?

the constonants will be extracted if you do not give the constonants thir given id

their given id :smiley::smiley::smiley::smiley::smiley::smiley::smiley::smiley::grin::grin::grin::rofl::rofl::rofl::joy::joy::joy::joy::joy::joy::laughing::laughing::laughing:

Tried this! Still gives me only one of the three words that needed to be printed unfortunately

Other than that I cannot think of anything. Try getting help from someone else.
Sorry, ruri5061864045

Thanks anyway, Miles :wink:

Your Welcome ruri5061864045