Created
May 7, 2012 05:23
-
-
Save bryanbibat/2626072 to your computer and use it in GitHub Desktop.
assessment test spoilers
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
class Animal | |
def initialize(name, age) | |
@name, @age = name, age | |
end | |
def getName | |
@name | |
end | |
def getAge | |
@age | |
end | |
end | |
class Dog < Animal | |
def getAge | |
@age * 7 | |
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
puts (1..500).select { |x| x % 2 == 0 && x % 3 == 0 } |
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
require 'sinatra' | |
set :port, 80 # also need to run this program as root | |
get '/' do | |
"Hello World" | |
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
puts "enter sentence" | |
sentence = gets.chomp.downcase.gsub(" ", "") | |
puts "sentence is #{ sentence.reverse == sentence ? "a" : "not a"} palindrome" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment