Ruby exercise in Learn to Program