Skip to content

Instantly share code, notes, and snippets.

@PandaWhisperer
Created October 9, 2017 18:27
Show Gist options
  • Save PandaWhisperer/863100be30e7e3bfcc42bfbcb92879bc to your computer and use it in GitHub Desktop.
Save PandaWhisperer/863100be30e7e3bfcc42bfbcb92879bc to your computer and use it in GitHub Desktop.
def countwovels(str)
for vowel in 'aeiouAEIOU'.chars
count = str.count(vowel)
if count == 1
puts "#{vowel} appears #{count} time."
elsif count >= 2
puts "#{vowel} appears #{count} times."
end
end
end
str = 'All animals are equal but some are more equal than otheres.'
countwovels(str)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment