Blackjack

Difficulty:
Elementary

Tags:
arithmetic, splat operator

Instructions:
Write a method that takes any number of integers and returns true if they sum to 21, false otherwise. Hint: splat operator.

Code:
___

assert_equal twenty_one?(3, 4, 5, 6, 3), true
assert_equal twenty_one?(3, 11, 10), false
assert_equal twenty_one?(10, 11), true
assert_equal twenty_one?(10, 10), false

Your Solution

Ruby 1.9.3

Back to Problems