practice-problems-1/no_comments/05-count-vowels.rb
# Write a method that takes a string and returns the number of vowels
# in the string. You may assume that all the letters are lower cased.
# You can treat "y" as a consonant.
#
# Difficulty: easy.
Write a method that takes a string and returns the number of vowels
in the string. You may assume that all the letters are lower cased.
You can treat "y" as a consonant.

easy.
Write a method that takes a string and returns the number of vowels in the string . You may assume that all the letters are lower cased . You can treat " y " as a consonant . easy .
def count_vowels(string)
  vowels = "aeiou".split('').to_a
  count = 0
  for i in string.split('')
      if vowels.include?(i)
          count+= 1
      end
  end
  return count
end
def count_vowels ( string ) vowels = "aeiou" . split ( '' ) . to_a count = 0 for i in string . split ( '' ) if vowels . include? ( i ) count += 1 end end return count end
Write a method that takes a string and returns the number of vowels
in the string.
Write a method that takes a string and returns the number of vowels in the string .
string
<not_specific>