simple-exercises/ruby-exercises/easy-5.rb
# Censor
# ------------------------------------------------------------------------------
# Write a function censor(sentence, curse_words) that censors the words given.
# Replace the vowels in the curse word with "*".
Censor
Write a function censor(sentence, curse_words) that censors the words given.
Replace the vowels in the curse word with "*".
Censor Write a function censor ( sentence curse_words ) that censors the words given . Replace the vowels in the curse word with " * " .
def asterisked(word)
  vowels = ["a", "e", "i", "o", "u"]
  new_word = ""
  word.each_char do |c|
    if vowels.include?(c)
      new_word << "*"
    else
      new_word << c
    end
  end
  new_word
end
def asterisked ( word ) vowels = [ "a" , "e" , "i" , "o" , "u" ] new_word = "" word . each_char do | c | if vowels . include? ( c ) new_word << "*" else new_word << c end end new_word end
Censor
Write a function censor(sentence, curse_words) that censors the words given.
Censor Write a function censor ( sentence curse_words ) that censors the words given .
word
<not_specific>