---
# System prepended metadata

title: Day 2 Activities
tags: [Gemcamp]

---

# Day 2 Activities
In your `gemcamp_ruby_basic` repository, please create a new folder named array_and_hashes and solve the following problems. Ensure that your commits are meaningful and clearly describe the following problems.


1. You have a list of fruits, Add the fruit "orange" to the list and print the updated list.
    ```ruby=
    ["apple", "banana", "cherry", "date"]
    ```
2. You are given an array of numbers, Remove the last number from the array and print the result.
    ```ruby=
    [10, 20, 30, 40, 50]
    ```
3. Create an array that contains the days of the week, from Monday to Sunday. Print the third day in the array.
4. You have an array of colors, Replace "yellow" with "purple" and print the new array.
    ```ruby=
    ["red", "blue", "green", "yellow"]
    ```
5. Given the following array, sort the array in ascending order and print the result.
    ```ruby=
    [2, 5, 3, 8, 1]
    ```
1. You have an array of numbers: . Combine all numbers into a string, separated by hyphens ("-"), and print the result.
    ```ruby=
   [100, 200, 300, 400, 500]
    ```
1. Create an array of your 5 favorite movies. Print the length of the array.
1. You have an array of students’ scores, Find the highest score in the array and print it.
   ```ruby=
   [85, 90, 78, 92, 88]
    ```
1. Given an array, remove the first element and print the updated array.
    ```ruby=
    ["cat", "dog", "rabbit", "hamster"]
    ```
1. You have an array of countries, Find and print the index of "Mexico".
    ```ruby=
   ["USA", "Canada", "Mexico", "Germany", "France"]
    ```
1. Create an array with the names of 4 family members. Print the last name in the array.
1. Given an array of numbers , reverse the array and print the result.
   ```ruby=
    [3, 6, 9, 12, 15]
    ```
1. Create an array with five different animals. Replace the third animal with "tiger" and print the updated array.
1. You have two arrays: `["red", "green", "blue"]` and `["yellow", "purple", "pink"]`. Combine them into one array and print the result.
1. You have an array of 5 items. Print each item with its index using a loop.
1. You are given an array of letters: `["a", "b", "c", "d", "e"]`. print "f is found" if the letter "f" is in the array
1. Create an array of five random numbers. Add two more numbers to the beginning of the array and print the updated array.
1. Given an array `[1, 2, 3, 4, 5]`, remove any duplicate elements (if there are any) and print the unique values.
1. Create a hash to represent a library book with the following information: title is "koda", author is "mark", and pages is 100. Print the book's title.
1. You have a hash that stores the prices of different fruits: . Add a new fruit "orange" with a price of 4 and print the updated hash.
    ```ruby=
    { apple: 2, banana: 1, cherry: 3 }
    ```
1. There is a hash representing a student’s grades, Update the grade for English to 95 and print the updated hash.
    ```ruby=
    { math: 90, english: 85, science: 88 }
    ```
1. You have a hash of items in a shopping cart, Remove the item "watch" from the cart and print the updated hash.
    ```ruby=
    { shoes: 50, bag: 30, watch: 20 }
    ```
1. Create a hash with three of your favorite books and their authors. Print the author of the second book.
1. Add a new key-value pair for "job" with the value "developer" and print the updated hash.
    ```ruby=
    { name: "John", age: 25, city: "New York" }
    ```
1. There is a hash that contains details about a car, Update the year to 2020 and print the updated hash.
    ```ruby=
    { maker: "Toyota", model: "Corolla", year: 2015 }
    ```
1. Print all the keys in the hash.
    ```ruby=
    { one: 1, two: 2, three: 3 }
    ```
1. Print all the values in the hash.
    ```ruby=
    { red: "#FF0000", green: "#00FF00", blue: "#0000FF" }
    ```
1. Create a hash to store information about your favorite movie: title, director, year, and rating. Print the entire hash.
1. Print the name of person 2
    ```ruby=
    {
     person1: {name: "Alice", age: 30}, 
     person2: {name: "Bob", age: 25}
    }
    ```
1.  Print the capital of France.
    ```ruby=
    {
     usa: { capital: "Washington", population: 331},
     france: { capital: "Paris", population: 67}
    }
    ```
1. Create a hash of hashes to represent two different students and their grades in Math and English. Print the English grade of the second student
1. Print the model of car1
    ```ruby=
    { 
      car1: {make: "Toyota", model: "Corolla"}, 
      car2: {make: "Ford", model: "Mustang"}
    } 
    ```
1. Print the name of player2 in Team B 
    ```ruby=
    {
        team_a: {player_1: "John", player_2: "Paul"}, 
        team_b: {player_1: "Sarah", player_2: "Lucy"}
    } 
    ```
1. Print the second number in the array.
    ```ruby=
    { numbers: [10, 20, 30, 40]}
    ```
1. Print the second red fruit.    
    ```ruby=
    { red: ["apple", "cherry"], yellow: ["banana", "lemon"]}
    ```
1. Print the second product from Store 2. 
    ```ruby=
    {
        store_1: { products: ["apples", "oranges"]}, 
        store_2: { products: ["bananas", "grapes"]}
    }
    ```
1. Create an array of hashes to represent students. Each hash should contain the following keys: "name", "age" and "grade", Print the name of the 10th student
1. Print your birthday by using the elements in the array, Example: (2000-01-01)
    ```ruby=
    [
        [1, 2, 3],
        [4, 5, 6],
        [7, 8, 9],
        ['-', 0]
    ]
    ```
