Names starting with Vowels

Guillermo Maquieira
2 min readMay 29, 2020

--

An unordered list of names can be a practical approach to iterate over them and determine which of them starts with a vowel.

Names such as “Albert”, “Elizabeth” and “Oliver” start with different vowels (‘A’, ‘E’ and ‘O’) but “John”, “Susan” and “Michael” don’t. By using a list of vowels we can match different names and conclude if our premise occurs, so let’s start by matching those lists.

Iterating over vowels and names lists.

A for loop will iterate over each vowel and make a comparison with the first letter of each name (also using a for loop to iterate over each name) and if a match occurs, a message will be displayed showing both name and vowel coincidence.

‘A’ will match with “Albert” and “Alice” but not with “Elizabeth”, “John”, “Susan” nor “Oliver”.
‘E’ will match with “Elizabeth” but not with “Albert”, “Alice”, “John”, “Susan” nor “Oliver”.
‘I’ won’t find any occurrence.
‘O’ will match with “Oliver” but not with “Albert”, “Alice”, “Elizabeth”, “John”, nor “Susan”.
‘U’ won’t find any occurrence.

The above explanation can be helpful for those that are still not familiar with for loops and different iterators.

Try it by yourself using different names and reducing lines of code for a more pythonic resolution approach.

Happy coding! 🐍

--

--