easy +10 pts

Replace vowels with stars

Transform a string by replacing every vowel with an asterisk.

Write a function `vowel_stars(s: str) -> str` that takes a string `s` and returns a new string where every vowel (a, e, i, o, u, in both lowercase and uppercase) is replaced by an asterisk `*`. All other characters (consonants, digits, spaces, punctuation) remain unchanged. The input string may be empty. The function should preserve the original ordering and case of non-vowel characters.

Constraints

Input string length is between 0 and 10,000. Only printable ASCII characters are used. Vowels are only the letters 'a', 'e', 'i', 'o', 'u' and their uppercase equivalents.

Example

>>> vowel_stars("hello world")
'h*ll* w*rld'
>>> vowel_stars("PYTHON")
'PYTH*N'
>>> vowel_stars("")
''
10 points ~10 min

Recent Submissions

No submissions yet — hit Run Tests to try!

Hints

Define a set of vowels including both cases.
Use a list comprehension to build the output character by character.
Remember to join the list into a string at the end.
Python 3
All tests passed!
Test Results
Press Ctrl+Enter or click Run Tests to execute your code.