Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Junior Perl

by hsweet (Pilgrim)
on Jun 14, 2001 at 06:06 UTC ( [id://88278]=note: print w/replies, xml ) Need Help??


in reply to Junior Perl

Just tonight I sat down with my 7 year old daughter and we wrote this snippet and had a lot of fun with it. (Just prints words backwards) We might add a bit to it to print a whole story backwards. print "Type a word\n"; $word=<STDIN>; chomp $word; $backward=reverse ($word); print $backward; Anyhow, I think this is about the right speed for a kid. Language things are fun, and it was easy to explain that $word is a kind of noun, print a kind of verb, ; is like a period at the end of a sentance. The idea of algorithm will kick in as problem solving if we try to work with whole (English) sentences, since we will have to reverse the words first, then the letters in each word to keep the whole thing in order. Plus you would be using Perl as a text processing language which it is real good at. I figure it should be possible to do simple s///'s at some point to screw up certain words.

Replies are listed 'Best First'.
Re: Re: Junior Perl
by Odud (Pilgrim) on Jun 14, 2001 at 12:54 UTC
    That looks just the right sort of thing to do - it's fun, silly, and instructive all at the same time. As long as s/// is approached simply at first it shouldn't be too difficult to introduce and can do fun things. I was planning on something similar to start with. You could probably do something good with splitting a sentence into words and then printing them out in random order - introducing split, lists, etc. Then perhaps have a hash that holds replacements for words etc...

    The only thing that concerns me is the lack of graphics as I'm not sure how long simple word games will hold her attention. I might look at doing something with Tk - perhaps create a very simple interface that lets you do things with colors and text, it should be possible to package away most of the complexity - I'll post it if it works out.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://88278]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2024-03-29 15:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found