/logins

Small ruby exercise

Primary LanguageRuby

This is a small ruby exercise.

In the logins.rb there is a people array with [id, name], and you have a logins hash with the keys as the ids of the people.

Your goal is to print a nested hash on the screen where you count logins per year for each person.

The end result should be similar to this:

{
  "matayo"=>{1973=>1, 1980=>1, 2010=>1, 2003=>1, 1976=>1, 2005=>1, 2011=>1, 1989=>1},
  "nico"=>{1976=>1, 1988=>1, 2005=>1, 1980=>1, 1983=>1, 1972=>2, 1987=>1},
  "angelo"=>{1982=>1, 2006=>1, 1988=>1, 1992=>2, 2016=>1, 1995=>2},
  "luca"=>{1992=>1, 1970=>1, 1972=>1, 1978=>1, 1976=>1, 2004=>1, 2009=>1, 2011=>1}},
}