DEV Community

Discussion on: Daily Challenge #148 - Disemvowel Trolls

Collapse
 
ultrainstinct05 profile image
Ashwin Shenoy

Python solution.

def disemvowel(string):
    """Removes all occurences of vowel from the string.

    Args:
        string (str): The input string.

    Returns:
        temp_string (str): The resultant string with vowels removed.
    """
    final_string = ""
    for i in string:
        if i.lower() in ["a", "e", "i", "o", "u"]:
            continue
        else:
            final_string += i
    return final_string

if __name__ == '__main__':
    print(disemvowel("This website is for losers LOL!"), "Ths wbst s fr lsrs LL!")
Collapse
 
rafaacioly profile image
Rafael Acioly

you could use regex to keep it simple :)

Collapse
 
ultrainstinct05 profile image
Ashwin Shenoy

I am yet to study about regexes :)