Skip to content

Latest commit

 

History

History
56 lines (29 loc) · 892 Bytes

Disemvowel_Trolls.md

File metadata and controls

56 lines (29 loc) · 892 Bytes

CodeWars Python Solutions


Disemvowel Trolls

Definition

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.


Given Code

def disemvowel(string):
    return string

Solution 1

def disemvowel(string):
    return "".join([ch for ch in string if ch not in "aeiouAEIOU"])

Solution 2

def disemvowel(s):
    return s.translate(None, "aeiouAEIOU")

See on CodeWars.com