나는 이렇게 학습한다/Algorithm & SQL

1031. Vowel remover

daco2020 2022. 10. 31. 20:51
반응형

Create a function called shortcut to remove the lowercase vowels (a, e, i, o, u ) in a given string.

Examples

"hello"     -->  "hll"
"codewars"  -->  "cdwrs"
"goodbye"   -->  "gdby"
"HELLO"     -->  "HELLO"
  • don't worry about uppercase vowels
  • y is not considered a vowel for this kata



Solution:

def shortcut(s):
    return ''.join(i for i in s if i not in "aeiou")

def shortcut(s):
    return s.translate(None, 'aeiou')


반응형