Created
October 9, 2017 18:27
-
-
Save PandaWhisperer/863100be30e7e3bfcc42bfbcb92879bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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