Very simple programming exercises

Hi,

I am reading ruby from the book "Programming ruby" and that book lacks
programming exercises. I want to work out some problems in ruby.

Please point me towards a good resource on the net or it can be a book
also.

thanks

···

--
Posted via http://www.ruby-forum.com/.

http://codekata.pragprog.com/

···

On Jun 6, 2010, at 21:48 , Lakshmanan Muthukrishnan wrote:

Hi,

I am reading ruby from the book "Programming ruby" and that book lacks
programming exercises. I want to work out some problems in ruby.

Please point me towards a good resource on the net or it can be a book
also.

Codingbat.com has lots of simple easy problems, but it's mostly Java and a
little bit of Python. Still, you can solve the problem however you like, you
just won't be able to use their automatic tester.

There are also a bunch at spoj.pl but I found that site frustrating, because
it's too dependent on string format of your output (a stray newline will
invalidate your solution, but you aren't given enough feedback to figure out
what formatting needs to change) And their time constraints are aimed at
compiled languages, which frequently prevents Ruby from being a possibility.

codechef.com is basically spoj.pl taken to the next level with a community
and flashy design. But I have had a lot of trouble getting their Ruby to
work right for me, and they don't keep track of which solutions you've
previously solved, so you can't really make a goal of solving all the
problems they have. I'll probably try it again in 6 months or so, see if
they've made that stuff better.

If you like math, projecteuler.net is a good choice, math problems whose
scope is large enough that they usually require writing a program in order
to solve them. Hardcore number crunching isn't a great domain for Ruby,
though, and the problems get quite advanced pretty quickly. I maxed out at
140 solved. But the problem solving skills of math complement the problem
solving skills of programming (imo, anyway). I found it very helpful for
developing problem solving skills, and figuring out how to transform what I
have into what I want.

I'm teaching some friends Ruby, and took a bunch of problems from a lot of
different places, they have automated tests that you can run locally, and
solutions also. If you're interested, let me know, and I can put up
installation instructions, so that you can try your hand at it. (you'll need
to have git installed to get updates, or copy and paste a lot of files, I'm
sort of building it as we go, there are 30 problems at present)
Some examples of the challenges
http://github.com/JoshCheek/JoshsRubyKickstart/blob/master/ch2/challenge/1_input_output.rb
http://github.com/JoshCheek/JoshsRubyKickstart/blob/master/ch2/challenge/12_classes.rb
http://github.com/JoshCheek/JoshsRubyKickstart/blob/master/ch3/challenge/3_hashes.rb
There are also solutions included (though many do not have a single correct
answer, and I try to keep the solutions within the scope of what we have
covered together).

···

On Sun, Jun 6, 2010 at 11:48 PM, Lakshmanan Muthukrishnan < lakshmanan@vinsol.com> wrote:

Hi,

I am reading ruby from the book "Programming ruby" and that book lacks
programming exercises. I want to work out some problems in ruby.

Please point me towards a good resource on the net or it can be a book
also.

thanks
--
Posted via http://www.ruby-forum.com/\.

Lakshmanan Muthukrishnan wrote:

Hi,

I am reading ruby from the book "Programming ruby" and that book lacks
programming exercises. I want to work out some problems in ruby.

Please point me towards a good resource on the net or it can be a book
also.

Maybe it's name changed?

$ gem search -r nntp

*** REMOTE GEMS ***

nntp (1.0.0)
ruby-net-nntp (1.0.0)

Regards,

Dan

Josh Cheek wrote:

···

On Sun, Jun 6, 2010 at 11:48 PM, Lakshmanan Muthukrishnan < > lakshmanan@vinsol.com> wrote:

Posted via http://www.ruby-forum.com/\.

Codingbat.com has lots of simple easy problems, but it's mostly Java and
a
little bit of Python. Still, you can solve the problem however you like,
you
just won't be able to use their automatic tester.

There are also a bunch at spoj.pl but I found that site frustrating,
because
it's too dependent on string format of your output (a stray newline will
invalidate your solution, but you aren't given enough feedback to figure
out
what formatting needs to change) And their time constraints are aimed at
compiled languages, which frequently prevents Ruby from being a
possibility.

codechef.com is basically spoj.pl taken to the next level with a
community
and flashy design. But I have had a lot of trouble getting their Ruby to
work right for me, and they don't keep track of which solutions you've
previously solved, so you can't really make a goal of solving all the
problems they have. I'll probably try it again in 6 months or so, see if
they've made that stuff better.

......

Thank you so much
--
Posted via http://www.ruby-forum.com/\.

Hi,

If you like math, projecteuler.net is a good choice, math problems whose
scope is large enough that they usually require writing a program in order
to solve them. Hardcore number crunching isn't a great domain for Ruby,
though, and the problems get quite advanced pretty quickly. I maxed out at
140 solved. But the problem solving skills of math complement the problem
solving skills of programming (imo, anyway). I found it very helpful for
developing problem solving skills, and figuring out how to transform what I
have into what I want.

I would like to thank you for the link to project Euler, it is really
interesting !

Please point me towards a good resource on the net or it can be a book
also.

I would also recommend Ruby Quiz

Regards,
B.D.

···

On 7 June 2010 09:31, Josh Cheek <josh.cheek@gmail.com> wrote:

On Sun, Jun 6, 2010 at 11:48 PM, Lakshmanan Muthukrishnan < > lakshmanan@vinsol.com> wrote:

Search for "code golf". I personally have enjoyed
http://golf.shinh.org/because the problems tend to be very simple. It
helps you learn the pros
and cons of various languages.

-Jake

···

On Mon, Jun 7, 2010 at 4:40 AM, Lakshmanan Muthukrishnan < lakshmanan@vinsol.com> wrote:

Josh Cheek wrote:
> On Sun, Jun 6, 2010 at 11:48 PM, Lakshmanan Muthukrishnan < > > lakshmanan@vinsol.com> wrote:
>
>> Posted via http://www.ruby-forum.com/\.
>>
>>
> Codingbat.com has lots of simple easy problems, but it's mostly Java and
> a
> little bit of Python. Still, you can solve the problem however you like,
> you
> just won't be able to use their automatic tester.
>
> There are also a bunch at spoj.pl but I found that site frustrating,
> because
> it's too dependent on string format of your output (a stray newline will
> invalidate your solution, but you aren't given enough feedback to figure
> out
> what formatting needs to change) And their time constraints are aimed at
> compiled languages, which frequently prevents Ruby from being a
> possibility.
>
> codechef.com is basically spoj.pl taken to the next level with a
> community
> and flashy design. But I have had a lot of trouble getting their Ruby to
> work right for me, and they don't keep track of which solutions you've
> previously solved, so you can't really make a goal of solving all the
> problems they have. I'll probably try it again in 6 months or so, see if
> they've made that stuff better.

......

Thank you so much
--
Posted via http://www.ruby-forum.com/\.

I strongly disagree that code golf is a good learning exercise for a beginner.

The first goal of newbie should be to learn to write clean understandable code.

Code golf, where the goal is to write a program in the minimum of
characters, might be an interesting intellectual exercise, but it
leads to writing cryptic code which is just the opposite of what a
beginner should be learning.

Besides Dave Thomas code katas which Ryan mentioned. It might be
worthwhile to have a look at the old RubyQuiz site

http://rubyquiz.com/

···

On Mon, Jun 7, 2010 at 7:35 AM, Jacob Mitchell <jacob.d.mitchell@gmail.com> wrote:

Search for "code golf". I personally have enjoyed
http://golf.shinh.org/because the problems tend to be very simple. It
helps you learn the pros
and cons of various languages.

-Jake

--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Github: rubyredrick (Rick DeNatale) · GitHub
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

The way I've used code golf breaks with tradition. I try to write clean yet
concise code that solves the problem. It's a great way to start playing
with a language that you're not familiar with because, again, the problem
statements are *very* simple. It has helped me learn the basics of various
languages like the back of my hand.

-Jake

···

On Mon, Jun 7, 2010 at 7:45 AM, Rick DeNatale <rick.denatale@gmail.com>wrote:

On Mon, Jun 7, 2010 at 7:35 AM, Jacob Mitchell > <jacob.d.mitchell@gmail.com> wrote:
> Search for "code golf". I personally have enjoyed
> http://golf.shinh.org/because the problems tend to be very simple. It
> helps you learn the pros
> and cons of various languages.
>
> -Jake

I strongly disagree that code golf is a good learning exercise for a
beginner.

The first goal of newbie should be to learn to write clean understandable
code.

Code golf, where the goal is to write a program in the minimum of
characters, might be an interesting intellectual exercise, but it
leads to writing cryptic code which is just the opposite of what a
beginner should be learning.

Besides Dave Thomas code katas which Ryan mentioned. It might be
worthwhile to have a look at the old RubyQuiz site

http://rubyquiz.com/

--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Github: rubyredrick (Rick DeNatale) · GitHub
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

Agreed on all points, Rick. Ruby Quiz is a treasure trove of interesting Ruby problems and solutions. Also, code katas as mentioned previously are a great way to train your "muscle memory" and ingrain proper idioms and techniques. Highly recommended.

···

On 2010-06-07 04:45:51 -0700, Rick DeNatale said:

On Mon, Jun 7, 2010 at 7:35 AM, Jacob Mitchell > <jacob.d.mitchell@gmail.com> wrote:

Search for "code golf". I personally have enjoyed
http://golf.shinh.org/because the problems tend to be very simple. It
helps you learn the pros
and cons of various languages.

-Jake

I strongly disagree that code golf is a good learning exercise for a beginner.

The first goal of newbie should be to learn to write clean understandable code.

Code golf, where the goal is to write a program in the minimum of
characters, might be an interesting intellectual exercise, but it
leads to writing cryptic code which is just the opposite of what a
beginner should be learning.

Besides Dave Thomas code katas which Ryan mentioned. It might be
worthwhile to have a look at the old RubyQuiz site

http://rubyquiz.com/

--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Github: rubyredrick (Rick DeNatale) · GitHub
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

--
Rein Henrichs

http://reinh.com