Skip to content

Instantly share code, notes, and snippets.

Last active December 15, 2015 20:58
Show Gist options
  • Save anonymous/5321997 to your computer and use it in GitHub Desktop.
Save anonymous/5321997 to your computer and use it in GitHub Desktop.
pangur's file
#!/usr/bin/env ruby-2.0.0
contents = File.read('wlc.txt')
text = []
@nums = []
@questions = []
@answers = []
@combined = []
i = 0
puts "----------"
contents.each_line do |line|
text << line.chop
end
text.each do | thing |
if thing.start_with?('Q. ')
num, question = thing[3..-1].split(' ',1)
@nums << num
@questions << question
elsif thing.start_with?(' A. ')
answer = thing[4..-1]
@answers << answer
elsif thing.start_with?(/[0-9]/)
answer << thing
@answers << answer
end
end
@combined = @nums.zip(@questions, @answers).each do |num,question,answer|
end
@combined.each do |what|
puts what
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment