Skip to content

Instantly share code, notes, and snippets.

@jamesjtong
Created September 30, 2013 20:21
Show Gist options
  • Save jamesjtong/6769622 to your computer and use it in GitHub Desktop.
Save jamesjtong/6769622 to your computer and use it in GitHub Desktop.
lab 1
movie = {
action: ["Die Hard", "Fight Club"],
fantasy: ["Harry Potter", "Lord of the Rings", "Pokemon"] ,
comedy: ["Scary Movie", "Scary Movie 2", "Grown Ups"] ,
thriller: ["Freddy Kreuger", "Scream", "Texas Chainsaw Massacrew"],
romance: ["The Notebook"]
}
recipes = {
chicken_marsala: ["mushrooms","chicken","white wine", "marsala wine"],
fried_chicken: ["chicken wings", "breading", "flour", "oil", "corn starch"],
strawberry_soy_smoothie: ["strawberries", "soymilk", "soy yogurt", "soy icecream"]
}
user_profiles = {
james: {fav_colors: ["white","blue"], essays: ["essay_1","essay_2","essay_3"]},
john: {fav_colors: ["blue", "black"], essays: ["essay_1", "essay_2", "essay_3"]}
}
#Write a method that takes a sentence and returns it with each word reversed in place.
def reverse_each_word(sentence)
sentence.split.map {|word| word.reverse}.join(" ")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment