-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkyu7_disemvowel.py
More file actions
27 lines (21 loc) · 801 Bytes
/
kyu7_disemvowel.py
File metadata and controls
27 lines (21 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""
Trolls are attacking your comment section!
A common way to deal with this situation is to remove all of the vowels from the trolls' comments, neutralizing
the threat
Your task is to write a function that takes a string and return a new string with all vowels removed
For example, the string "This website is for losers LOL!" would become "Ths wbst s fr lsrs LL!"
Note: for this kata y isn't considered a vowel
"""
def disemvowel(string):
"""
:param string: sentence containing some vowels to be removed
:type: str
:return: sentence (string) without vowels
:rtype: str
"""
vowels = {'a', 'e', 'i', 'o', 'o', 'u'}
filtered_string = ''
for char in string:
if char.lower() not in vowels:
filtered_string += char
return filtered_string