From: Harry Kakueki Date: 2013-05-16T14:37:32+09:00 Subject: Re: n00b looking to learn from the best --047d7b2e3f2033311b04dccf2ff2 Content-Type: text/plain; charset=ISO-8859-1 # Here is a hint. # You may want to change some of the variable names. def try_this(shoe) Array.new(shoe.size){|horn| shoe[horn]*horn}.inject{|at,heel| at+heel} end foot = [1,2,3,4,5] p try_this(foot) #> 40 # http://www.ruby-doc.org/core-1.9.3/Array.html#method-c-new Harry --047d7b2e3f2033311b04dccf2ff2 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
# Here is a hint.
# You may want to change some of= the variable names.

def try_this(shoe)
=A0 Array.new(shoe.size){= |horn| shoe[horn]*horn}.inject{|at,heel| at+heel}
end

foot =3D [1= ,2,3,4,5]
p try_this(foot)=A0 #> 40

#=A0=A0=A0 http://www.ruby-doc.org/core-1.9= .3/Array.html#method-c-new


Harry

--047d7b2e3f2033311b04dccf2ff2--