Skip to content

Instantly share code, notes, and snippets.

@Beyarz
Last active February 2, 2020 01:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Beyarz/5383f866e86e96624469ba3846e1a2c7 to your computer and use it in GitHub Desktop.
Save Beyarz/5383f866e86e96624469ba3846e1a2c7 to your computer and use it in GitHub Desktop.
in Ruby
John
30
Mike
0.0786268
Tyson
0.114889
Gabriel
0.176072
Fiona
0.101895
list = File.open("example.txt", "r").readlines()
list.map(&:strip)
    .each_slice(2)
    .select { |x| puts x.join(' ') }
John 30
Mike 0.0786268
Tyson 0.114889
Gabriel 0.176072
Fiona 0.101895
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment