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 'minitest/autorun' | |
require 'minitest/pride' | |
# Write a method which returns a hash. | |
# WRITE YOUR CODE HERE. Name your method `get_hash`. | |
def get_hash | |
hash= {"Pizza" => "Unhealthy", | |
"French Fries" => "Okay", | |
"Broccoli" => "Healthy", |
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 'minitest/autorun' | |
require 'minitest/pride' | |
# Write a method which accepts an array and returns a hash. Each item in the | |
# array will be a string, and the returned hash should have last names as keys | |
# and first names as values. | |
# WRITE YOUR CODE HERE. Name your method `names`. | |
def names (input) | |
hash = ["Washington"=>"George", "Adams"=>"John"] |
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 'minitest/autorun' | |
require 'minitest/pride' | |
def palindrome?(input) | |
input.downcase! | |
array = input.split(" ") | |
array = array.join | |
input2 = array.to_s | |
if input2 == input2.reverse | |
return true |
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 'minitest/autorun' | |
require 'minitest/pride' | |
def first_name(input) | |
string = [] | |
string << input.split(" ") | |
output = string[0] | |
return output | |
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
def fizzbuzz(fizzbuzz) | |
if fizzbuzz % 3 == 0 && fizzbuzz % 5 == 0 && fizzbuzz > 0 | |
return "FizzBuzz" | |
elsif fizzbuzz % 3 == 0 | |
return "Fizz" | |
elsif fizzbuzz % 5 == 0 | |
return "Buzz" | |
else | |
return fizzbuzz | |
end |
NewerOlder