Skip to content

Latest commit

 

History

History
45 lines (25 loc) · 639 Bytes

Exclamation_marks_series_11_Replace_all_vowel_to_exclamation_mark_in_the_sentence.md

File metadata and controls

45 lines (25 loc) · 639 Bytes

CodeWars Python Solutions


Exclamation marks series #11: Replace all vowel to exclamation mark in the sentence

Replace all vowel to exclamation mark in the sentence. aeiouAEIOU is vowel.

Examples

replace("Hi!") === "H!!"
replace("!Hi! Hi!") === "!H!! H!!"
replace("aeiou") === "!!!!!"
replace("ABCDE") === "!BCD!"

Given Code

def replace_exclamation(s):
    pass

Solution

def replace_exclamation(s):
    return "".join(["!" if c in "aeiouAEIOU" else c for c in s])

See on CodeWars.com