practice-problems-1/comments/05-count-vowels.rb
def count_vowels(string)
    vowels = "aeiou".split('').to_a #create an array of vowels
    count = 0                       # will return the count of vowels later
    for i in string.split('')       #look through array of the string's letters
        if vowels.include?(i)       #if string contains any letter in vowels
            count+= 1               #add one to overall count
        end
    end
    return count                    #return count at end
end
# 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 .
#create an array of vowels # will return the count of vowels later #look through array of the string's letters #if string contains any letter in vowels #add one to overall count #return count at end
string