code for assignment 'Ruby Exercises'