Enumerable Solutions
Write a method,
#words_with_a(array), that accepts an array of strings as an argument. It should return the number of strings that have an 'a' in them.def words_with_a(array) array.count { |string| string.include?("a") } endWrite a method,
#odds(array), that accepts an array of integers as an argument. It should return an array containing only the odd numbers.def odds(array) array.select { |n| n.odd? } endWrite a method,
#triple(array), that accepts an array of integers as an argument. It should return a new array with every element tripled.def tripple(array) array.map { |el| el * 3 } endWrite a method,
#odd_value_and_position(array), that accepts an array of integers as an argument. It should return a new array of all the elements whose value and position (index) in the original array are odd.def odd_value_and_position(array) array.select.with_index { |el, idx| el.odd? && idx.odd? } end