- fork this repo
- clone your repo to your computer
- make a new directory with your name
- put your answers in this directory
- make a commit for every question
- make a pull request before time is up!!!
Define a method called offer_rose
, which should take one argument named person
(String).
When called the method should print to the terminal:
"Would you take this rose, person
, in exchange for giving an old beggar woman shelter from the bitter cold?"
Assume the following hash...
town = {
residents: ["Maurice", "Belle", "Gaston"],
castle: {
num_rooms: 47,
residents: ["Robby Benson"],
guests: []
}
}
Using Ruby...
- Remove "Belle" from
residents
- Add "Belle" to the
guests
array Type your solution directly below this line:
Assume you have an array of strings representing friends' names...
friends = ["Chip Potts", "Cogsworth", "Lumière", "Mrs. Potts"]
Using a loop and string interpolation, print each string in friends
to the Terminal...
"Belle is friends with Chip Potts"
"Belle is friends with Cogsworth"
"Belle is friends with Lumière"
"Belle is friends with Mrs. Potts"
Assume the following array of hashes:
lost_boys = [
{name: 'Tootles', age: 11},
{name: 'Nibs', age: 9},
{name: 'Slightly', age: 10},
{name: 'Curly', age: 8},
{name: 'The Twins', age: 9}
]
Use .each
to iterate over the lost_boys
array and increase each boy's age by 30 years.
Assume the following array:
children = ['Wendy', 'John', 'Michael']
Use .map
to iterate through the children
array and add Darling
to the end
of their names. Assign the returned array to a variable called darling_children
.
Example: Wendy
should become Wendy Darling
in the new array.
Define a Ruby class called Animal
. Each Animal
should have...
- A
name
(String) attribute - A
greet
instance method - The ability to "get" and "set"
name
Create a new Animal
instance with the name "Pumba" an assign it to a variable named pumba
.
Write a method called toonify
that takes two parameters, accent
and sentence
.
- If
accent
is the string"daffy"
, return a modified version ofsentence
with all "s" replaced with "th". - If the accent is
"elmer"
, replace all "r" with "w". - Feel free to add your own accents as well!
- If the accent is not recognized, just return the sentence as-is.
toonify "daffy", "so you smell like sausage"
#=> "tho you thmell like thauthage"
Call the method twice with different arguments