-
carrier_hits=0
-
battleship_hits=0
-
cruiser_hits=0
This file contains 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
<span id="checkout">Checkout</span> |
A Pen by Ashley Ellis on CodePen.
This file contains 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: | |
# | |
# * "Fizz" if the number is divisible by 3 | |
# * "Buzz" if the number is divisible by 5 | |
# * "FizzBuzz" if the number is divisible by 3 and 5 | |
# * Otherwise, return the number itself | |
# |
This file contains 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 two methods: | |
# | |
# * `first_name`: given a name in string, return the first name. | |
# * `last_name`: given a name in string, return the last name. | |
def first_name(name) | |
if name== nil |
This file contains 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 palindrome?(word) | |
if word.downcase == word.downcase.reverse | |
result = true | |
else | |
result = false | |
end | |
result | |
end | |
class StringPalindromePuzzle < MiniTest::Test |
This file contains 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. | |
def names(array) | |
if array = Array.new || nil | |
Hash.new |
This file contains 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. | |
def get_hash | |
{"Pizza"=>"Unhealthy", "French Fries" => "Okay", "Broccoli" => "Healthy", "Chocolate" => "Healthy"} | |
end | |
This file contains 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
Find all authors with an email address of "shakespeare@example.com" | |
SELECT * | |
FROM authors | |
WHERE email= "shakespeare@example.com"; | |
Find the author who was created most recently | |
SELECT * |
This file contains 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 series of methods which use the .any, .all, .map, .select, .reject, and | |
# .reduce methods in Enumerable. Each of your methods should be one line. | |
# WRITE YOUR CODE HERE. In this challenge, names longer than 5 characters are | |
# considered long. | |
def has_even?(array) |
OlderNewer