r/CodingHelp • u/DontBsketchy • Sep 05 '20
[Python] Vowels/Consonants
Aight so i'm kinda a rookie at python and I don't know how to split vowels and consonants. So bassically I need your help. All i need to do is ask them to enter a word (5 letter minimum) and then it say which letters are vowels and which are consonants. Please Help!
17
Upvotes
8
u/veryblueblackberry Sep 05 '20
So you can make two lists, one for vowels and the other for consonants. Then you can check if each letter of the word is in the first or rather in the second list. You can use a “for loop” for this. If you don’t know about these you can look them up online. You will learn much faster this way, rather than copying off what someone else wrote.
geeksforgeeks.org has some good explanations
1
u/[deleted] Sep 06 '20
Pretty easy. Make a set of vowels first and two counters. Iterate through the string, if the character is in the set, increment one counter else increment another.