Temperature Robot

Difficulty:
Elementary

Tags:
case statements, ranges, ranges

Instructions:
Temperature bot is comfortable when it's room temperature (18-21C). Help him out by completing the method.

Code:
def temperature_bot(temp)
  # temperature bot is American but takes Celsius temperatures
  case temp
  when ___
    "I like this temperature"
  else
    "This is uncomfortable for me"
  end
end

assert_equal temperature_bot(18), "I like this temperature"
assert_equal temperature_bot(21), "I like this temperature"
assert_equal temperature_bot(22), "This is uncomfortable for me"
assert_equal temperature_bot(-3), "This is uncomfortable for me"

Your Solution

Ruby 1.9.3

Back to Problems