Ruby code for week 2