project: Coding aptitude assessment challenge: Task 9

Tags skill/problem_solving
Hard Prerequisites
IMPORTANT: Please review these prerequisites, they include important information that will help you with this content.
  • CODING_APTITUDE_ASSESSMENT: Introduction to coding challenges
  • CODING_APTITUDE_ASSESSMENT: IMPORTANT!! Naming your files and functions
  • Write a function that takes in a string and then returns all the vowels in the string.

    The returned vowels should be:

    • lowercase
    • in alphabetical order

    If a vowel appears twice in the input string then it should appear twice in the output.

    Language-specific instructions

    • if you are using Python then your function should return a List
    • if you are writing Javascript then your function should return an Array
    • if you are writing Java then your function should return an Array of Chars

    Example usage

    • task9("Hello there Andy") should return [a, e, e, e, o]
    • task9("xyz") should return []

    Check your understanding

    • How would you change your code if you wanted to handle multiple strings?
    • How would you change your code if you wanted to look for numbers or special characters?
    • If you used a loop then what kind of loop did you use and why?
    • How would you change your code if you wanted to return 2 lists/arrays: one with all the vowels and one with all the consonants
    • How would you change your code if we just wanted to count how many vowels were in the string?
    • Play with these ideas, challenge yourself and grow :)

    RAW CONTENT URL