Skip to content

Instantly share code, notes, and snippets.

@megstang
Created August 24, 2020 18:55
Show Gist options
  • Save megstang/bdde2a45273d1f92c71b483bb27f091f to your computer and use it in GitHub Desktop.
Save megstang/bdde2a45273d1f92c71b483bb27f091f to your computer and use it in GitHub Desktop.
Find all practice
  numbers = [5,1,13,2,7,9,10]
  1. Use each to return an array with all of the elements from the numbers array that have two or more digits.
  2. Refactor the code you implemented for #1 above to use find_all instead of each.
  3. Use each to find all of the elements from the numbers array whose squares are odd. (Example: 5 would be returned because 5^2 = 25 and 25 is odd. 10 would not be returned because 10^2 is 100 and 100 is even.
  4. Refactor the code you implemented for #3 above to use find_all instead of each.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment