Created
January 7, 2016 10:34
-
-
Save krokrob/34dbac96b061306d2921 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
# COUNT | |
# input : array | |
# output: fixnum = number of element which match with condition | |
array = ['Michel Polnareff', 'Michel Jonasz', 'Michel Delpech', 'Maxime Leforestier'] | |
counter = 0 | |
array.each do |singer| | |
if singer.split[1].downcase.include?("o") | |
counter += 1 | |
end | |
end | |
puts counter | |
counter = array.count do |star| | |
puts last_name = star.split.last | |
last_name.downcase.include?("o") | |
end | |
puts counter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment