<commit_before># I worked on this challenge [by myself, with: ].


i_want_pets = ["I", "want", 3, "pets", "but", "I", "only", "have", 2, ":(." ]
my_family_pets_ages = {"Evi" => 6, "Hoobie" => 3, "George" => 12, "Bogart" => 4, "Poly" => 4, 
            "Annabelle" => 0, "Ditto" => 3}

# Problem 1
def my_array_finding_method(source, thing_to_find)
  source.find_all{|word| word.to_s.include?(thing_to_find)}
end

def my_hash_finding_method(source, thing_to_find)
  source.find_key do |names, age| 
    name if age == thing_to_find
  end
end

# Identify and describe the ruby method you implemented. Follow guidelines in instructions.md
# 
#
#

# Problem 2
def my_array_modification_method(source, thing_to_modify)
  # Your code here!
end

def my_hash_modification_method(source, thing_to_modify)
  # Your code here!
end

# Identify and describe the ruby method you implemented. Follow guidelines in instructions.md
# 
#
#

# Problem 3
def my_array_location_method(source, thing_to_locate)
  # Your code here!
end

def my_hash_location_method(source, thing_to_locate)
  # Your code here!
end

# Identify and describe the ruby method you implemented. Follow guidelines in instructions.md
# 
#
#
# Problem 4
def my_array_deletion_method(source, thing_to_delete)
  #Your code here!
end

def my_hash_deletion_method(source, thing_to_delete)
  #Your code here!
end

# Identify and describe the ruby method you implemented. Follow guidelines in instructions.md
# 
#
#


################## DRIVER CODE ###################################
# HINT: Use puts statements to see if you are altering the original structure with these methods. 

# I want my method to return a list of words that contain a letter
my_array_finding_method(i_want_pets, "t") #=> should return ["want","pets","but"]

# I want my method to return a list of pet names by age
my_hash_finding_method(my_family_pets_ages, 3) #=> should return ["Hoobie", "Ditto"]

#I want this method to alter the actual structure.

# I've want more pets! I want to add one to every number in the structure.
my_array_modification_method(i_want_pets, 1) 
#=> ["I", "want", 4, "pets", "but", "I", "only", "have", 3, ":(." ]

#Two years have passed since I made this list, so it's out of date. We need to update our list!
my_hash_modification_method(my_family_pets_ages, 2) 
#=> {"Evi" => 8, "Hoobie" => 5, "George" => 14, "Bogart" => 6, "Poly" => 6, "Annabelle" => 2, "Ditto" => 5}

my_array_location_method(i_want_pets, "pets") #=> 3
my_hash_location_method(my_family_pets_ages) #hmm, need to think on this one


# Some letters are so annoying. I want to remove words that contain the offensive letter. 
my_deletion_method(i_want_pets, "a") 
#=> ["I", 3, "pets", "but", "I", "only", 2, ":(." ]

# Poor George passed away. He had a good life, but I need to remove him from my list. 
my_deletion_method(my_family_pets_ages, "George") 
#=> {"Evi" => 8, "Hoobie" => 5, "Bogart" => 6, "Poly" => 6, "Annabelle" => 2, "Ditto" => 5}

<commit_msg>added group challenge instructions<commit_after>#U1,W3: Group Challenge: Research Methods

## Learning Objectives
- Find and use built-in Ruby methods to solve challenges
- Iterate through data structures and manipulate the content

## Purpose
I'm sure many of you have looked through the [Ruby Docs](http://ruby-doc.org/) and had some
difficulty trying to figure out what methods do and how they work. You have probably also 
seen some people using methods you didn't know existed when you looked through other solutions.
In this challenge, you will practice reading through the docs to find existing enumerable methods and 
use them on `Array`s and `Hash`es. 

Research and test these methods out thoroughly. You may want to play around with them in IRB to 
figure out exactly how they work before you can implement them properly. 

## Directions
Refer to your accountability group spreadsheet to find your role. 
*NOTE: If you are in a five or six person group,
the fifth person will do the same challenge as the first, and the sixth will do the second. You can 
either pair or work independently.* 

Each person will receive a problem. Using the [Ruby Docs](http://ruby-doc.org/) find a method you can use
on both an array and a hash, and implement it to solve the challenge. 

Once you complete your challenge, Identify and describe the ruby method you implemented. Teach your 
accountability group how to use them. 

Each person will be working with the following `Array` and `Hash`: 
```ruby
i_want_pets = ["I", "want", 3, "pets", "but", "I", "only", "have", 2, ":(." ]
my_family_pets_ages = {"Evi" => 6, "Hoobie" => 3, "George" => 12, "Bogart" => 4, "Poly" => 4, 
  "Annabelle" => 0, "Ditto" => 3}
```

### Person 1: Find Matching Data
Create a method `my_array_finding_method` that takes an `Array` and a letter as arguments
and returns the words that contain that letter.

For example:
```ruby
my_array_finding_method(i_want_pets, "t") #=> should return ["want","pets","but"]
```

Create a method `my_hash_finding_method` that takes a `Hash` and number as arguments and 
returns a list of pet names by age. 
Ex. 
```ruby
my_hash_finding_method(my_family_pets_ages, 3) #=> should return ["Hoobie", "Ditto"]
```

### Person 2: Modify Existing Data
Two years have passed since I made these, so they need to be updated. **HINT: the actual 
data structures need to be modified**
I recently got a new pet, but I still want another!
Create a `my_array_modification_method` that takes an array and number to be added to all
internal numbers. (Because you can never have too many pets!) For example:

```ruby
my_array_modification_method(i_want_pets, 1) 
#=> ["I", "want", 4, "pets", "but", "I", "only", "have", 3, ":(." ] 
```

Then create a method that updates the ages in the hash. For Example:

```ruby
my_hash_modification_method(my_family_pets_ages, 2) 
#=> {"Evi" => 8, "Hoobie" => 5, "George" => 14, "Bogart" => 6, "Poly" => 6, "Annabelle" => 2, "Ditto" => 5}
```

### Person 3: Sort Data
I want to create a sorting method that alphabetizes an array. I also want to create a sorting method that arranges
my hash by age (starting with the youngest first). This should not modify the existing data structure.

```ruby
my_array_sorting_method(i_want_pets, "pets") #=>
["3", "4", "I", "but", "have", "only", "pets", "want"]

my_hash_sorting_method(my_family_pets_ages, age) #=>
[["Annabelle", 2], ["Ditto", 5], ["Hoobie", 5], ["Bogart", 6], ["Poly", 6], ["Evi", 8], ["George", 14]] 
# This may be false depending on how your method deals with ordering the animals with the same ages.
``

### Person 4: Delete Matching Data
Sometimes you no longer need data that matches something. Create a `my_array_deletion_method` that takes an array
and a letter, and deletes all the strings that contain that letter. This should modify the existing structure.
For example: 
```ruby 
my_deletion_method(i_want_pets, "a") 
#=> ["I", 4, "pets", "but", "I", "only", 3, ":(." ]
```

Poor George passed away. He had a good life, but I need to remove him from my list. 

```ruby
my_deletion_method(my_family_pets_ages, "George") 
#=> {"Evi" => 8, "Hoobie" => 5, "Bogart" => 6, "Poly" => 6, "Annabelle" => 2, "Ditto" => 5}
```

### Push your solutions and grab others!
Push your solutions to your repo on GitHub, then find your accountability groups' solutions. Review them. 
Which existing methods did they use? Try to use them based on the instructions your group-mate included. 

### Reflect
Use the [reflection guidelines](../week_2/reflection_guidelines.md) and also discuss the following:
- What did you learn about researching?


{'fraction_non_alphanumeric': 0.1260692196341624, 'fraction_numerical': 0.011054086063955783, 'mean_word_length': 4.714285714285714, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 58, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5554012', 'n_tokens_mistral': 2620, 'n_tokens_neox': 2432, 'n_words': 1001}