Anonymous user
Ranking methods: Difference between revisions
→{{header|Ruby}}: small improvement
m (added whitespace before the TOC (table of contents), added other whitespace to the task's preamble.) |
(→{{header|Ruby}}: small improvement) |
||
Line 1,627:
41 Barry
39 Stephen".lines.map{|line| line.split}
▲grouped = ar.group_by{|pair| pair.delete_at(0).to_i}
s_rnk = 1
m_rnk =
puts "stand.\tmod.\tdense\tord.\tfract."
grouped.each.with_index(1) do |(score, names),
m_rnk += names.flatten!.size
f_rnk = (s_rnk + m_rnk)/2.0
names.each do |name|
o_rnk += 1
puts "#{s_rnk}\t#{m_rnk}\t#{d_rnk}\t#{o_rnk}\t#{f_rnk.to_s.
end
s_rnk += names.size
end</lang>
{{out}}
<pre>
1 1 1 1 1 44 Solomon
2 3 2 2 2.5 42 Jason
|