<commit_before><commit_msg>add gps2.2.rb<commit_after>#Psuedocode 

#create a new list
#assign hash to variable

#Method 1: Create Item
#takes 2 parameters, item and quantity
#add item to hash and set value to quantity

#Method 2: Remove Item
#delete parameter from hash

#Method 3: Update Quantity
#takes 2 parameters, item and quantity
#change item's value to quantity

#Method 4: Print list
#iterate through hash and print each key value pair

#Initial Solution
$list = Hash.new()

def create(item, quantity)
  $list[item.to_sym] = quantity
end

def remove(item)
  $list.delete(item.to_sym)
end

def update(item, quantity)
  $list[item.to_sym] = quantity
end

def print_list()
  $list.each {|k, v| puts "#{k}: #{v}"}
end

#Refactored Solution

def create(item, quantity)
  $list[item] = quantity
end

def remove(item)                
  $list.delete(item)
end

def update(item, quantity)
  $list[item] = quantity
end

def print_list
  $list.each {|item, quantity| puts "#{item}: #{quantity}"}
end

create("lemonade", 2)
create("tomatos", 3)
create("onions", 1)
create("icecream", 4)

remove("lemonade")

update("icecream", 1)

print_list

#What did you learn about pseudocode from working on this challenge?
# => Ruby is just one step up from Psuedocode basically

#What are the tradeoffs of using Arrays and Hashes for this challenge?
# => Hashes are better for this I think because it can store the quantity as well, which the array can't as easily.

#What does a method return?
# => The last evaluated expression, nil, or something that uses the return statement.

#What kind of things can you pass into methods as arguments?
# => Any object.

#How can you pass information between methods?
# => By passing it parameters and using return values.

#What concepts were solidified in this challenge, and what concepts are still confusing?
# => I got a better ideas of hashes and symbols with this.
{'fraction_non_alphanumeric': 0.09531332280147446, 'fraction_numerical': 0.006845708267509215, 'mean_word_length': 4.507246376811594, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '6296697', 'n_tokens_mistral': 598, 'n_tokens_neox': 581, 'n_words': 255}