This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Place the bread in front of you. | |
2. Place the plate to the side of the bread. | |
3. Remove the tie from the bag of bread. | |
4. Remove the first piece of bread from the bag and set it aside. | |
5. Remove the next two slices of bread and put them next to one another on the plate. | |
6. Place the set aside piece of bread back into the bag. | |
7. Re-tie the bread bag so that it is sealed. | |
8. Move the bread bag out of your way. | |
9. Place the peanut butter in front of you. | |
10. Put the knife next to the peanut butter. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE artists( | |
worstbandname TEXT, | |
fartsperday INTEGER | |
); | |
ALTER TABLE artists ADD COLUMN instrument TEXT; | |
DROP TABLE artists; | |
CREATE TABLE artists( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Given this List of Songs, Construct Arrays by Artist and Album | |
# Hint: Make use of the split() String Method | |
# http://www.ruby-doc.org/core-1.9.3/String.html#method-i-split | |
# Simple Example of Data Parsing | |
songs = [ | |
"The Magnetic Fields - 69 Love Songs - Parades Go By", | |
"The Magnetic Fields - Get Lost - Smoke and Mirrors", | |
"Neutral Milk Hotel - In An Aeroplane Over the Sea - Holland 1945", | |
"The Magnetic Fields - Get Lost - You, Me, and the Moon", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#You're hosting a conference and need to print badges for the speakers. Each badge should say: "Hello, my name is #_____." | |
#Write a method that will create and return this message, given a person's name. | |
#Now the list of speakers is finalized, and you can send the list of badges to the printer. Remember that you'll #need to give this list to the printer, so it should be accessible outside of the method. | |
#Modify your method so it can take a list of names as an argument and return a list of badge messages. | |
#Your conference speakers are: Edsger, Ada, Charles, Alan, Grace, Linus and Matz. How you scored these luminaries #is beyond me, but way to go! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Let's go back to the exercise where we determined what is and isn't a vowel. With ruby, there's always more than #one way to do something and get the same result. | |
# | |
#Assuming vowels a,e,i,o,u: | |
# | |
# Write a method that returns whether a given letter is a vowel, using if and elsif | |
# Write a method that returns whether a given letter is a vowel, using case | |
# Write a method that returns whether a given letter is a vowel, using if with no else, all on a single line | |
#Write a method that returns whether a given letter is a vowel without using if or case while all on a single #line | |
# Write a method that returns whether a given letter is a vowel without checking equality, or the use of if, #using the array of vowels | |
#Write a method that will evaluate a string and return the first vowel found in the string, if any |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def normalize_phone_number(number) | |
array = number.split("") | |
finalnum = [] | |
array.each do |var| | |
if "1,2,3,4,5,6,7,8,9,0".include?(var) | |
finalnum << var | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Jukebox Program | |
#Greeting and setup for the program. | |
puts "Hello and welcome to the jukebox." | |
puts "Please let me know your name..." | |
name = gets.chomp | |
puts "" | |
puts "Okay #{name.capitalize}, let me tell you how this works." | |
puts "" | |
puts "You can type any of the following commands..." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# overall hash | |
# 2 subhashes, team 1 and team 2 | |
# each team has 3 subhashes name, colors, players | |
# name = just pointer | |
# colors = array | |
# players = array | |
# player has the following hashes in an array: name, number, shoe_size, points, rebounds, assists, steals, blocks, slam_dunks | |
hashketball = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. holiday_supplies[:summer][:forth_of_july][1] | |
2. holiday_supplies[:winter][:christmas] << "Tree" | |
3. holiday_supplies[:spring][:memorial_day] << "Charcoal" | |
4. holiday_supplies[:summer].merge!(:august_second => ["cake", "booze"]) | |
5. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Tower of Hanoi | |
#rules: | |
# arrays will be the pegs | |
# each array goes from top on left to bottom on right | |
# win/stop when c = [1,2,3,4] | |
#pieces cannot go to a space where a lower number is farther into the array. | |
def move_disc | |
a = [1,2,3,4] |
OlderNewer