반응형
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')
반응형
'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글
1102. Welcome to the City (0) | 2022.11.02 |
---|---|
1101. Fix your code before the garden dies! (0) | 2022.11.01 |
1030. How many stairs will Suzuki climb in 20 years? (0) | 2022.10.30 |
1029. Printing Array elements with Comma delimiters (0) | 2022.10.29 |
1028. Will you make it? (0) | 2022.10.29 |