Q:

How many Friday 13ths in a year?

The only thing that is wrong in this code is the return :P
How would you display how many Friday 13ths there in a year?
def unlucky_days(year)
    require 'date'

  start_date = Date.new(year)
  end_date = Date.new(year+1)
  my_fridays = [4]
  thirteen = "13"
  result = (start_date..end_date).to_a.select {|k| my_fridays.include?(k.wday) && thirteen.include?(k.strftime('%d'))}

  result.length

end

A:

I'd write:
require 'date'
(1..12).count { |month| Date.new(year, month, 13).friday? }

A:

+1 to @MarkReed's comments. Also, why call .to_a on a range, and why use variables when the Date class in Ruby already has methods like .day and .friday? Here is how I would do it: 
def unlucky_days(year)
  s = Date.new(year, 1, 1)
  e = Date.new(year, 12, 31)
  ((s...e).select {|d| d.friday? && d.day == 13 }).count
end

