[Tutor] Re: Ideas for beginning programs? games, math,
UNIX-style filters
Aztech Guy
aztech1200 at yahoo.com
Tue Aug 3 17:38:16 CEST 2004
Hi Bryan,
As some others have suggested, games (in your case,
I's suggest starting off with small ones, since you
say you're a beginner) are generally considered a
great way to learn programming - not to mention having
fun ..... :-)
So you could try some simple, known games, or even
make up some simple games of your own, and then write
programs that implement them. e.g. the guess a number
game (already mentioned by some), tic-tac-toe (noughts
and crosses), Nim, etc.
Programs to do mathematical calculations are another
good area, and you don't need a Ph.D. in math. for
many of the areas, either. There's a whole category of
simple math./arithmetic problems that can be solved by
writing programs. Examples:
- finding prime numbers
- finding the only/some/all numbers in a given range,
that satisfy some property, like:
- starts with a given digit(s) / has a given
digit(s) / ends with ditto
- sum of the digits is even / odd / a prime / other
...
- finding perfect numbers (Google to know what it
is)
- finding factorials, Fibonacci numbers
- alphanumeric puzzles, example:
SEND
+ MORE
------
MONEY
In the above problem, you have to find the digits that
the letters represent, such that substiting the digits
makes the above a valid sum, i.e. SEND + MORE = MONEY.
Google for 'math puzzles' or 'arithmetic puzzles' or
similar phrases to get more ideas .......
Programs like UNIX filters can be fun, too - these are
programs that read some input, either from standard
input or from a file, do some processing of some kind
on the data read, and write the results to standard
output. e.g. printing/deleting lines that contain a
certain letter/word/phrase, summing up numbers in a
given column of the input, counting the number of
characters, lines and words, converting upper case to
lower or vice versa, removing punctuation, changing
multiple spaces/tabs to a single space/tab, etc....
To get some info about filters (also known as
command-line utilities, try reading this article of
mine on the subject:
http://www-106.ibm.com/developerworks/opensource/library/l-clutil
Its written in C, not Python, and you might find it
slightly on the advanced side; on the other hand, it
was written as a tutorial-cum-example on writing
filters, and I think the topic is explained with a
good amount of detail, step by step, so you may be
able to get enough info about how to write a filter,
and then write some in Python - yes, filters can be
written quite easily in Python too - it supports
standard input/output/error. Also the filters you
write, unless they use any UNIX-specific features,
should work on Windows as well, possibly with some
changes.
HTH
Az.
> Bryan Fields <bryan <at> unitedgaribay.com> writes:
>
> > My question to the list is: Can anyone present me
> with some good ideas for
> > programs to write using the concepts I have
> studied so far?
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the Tutor
mailing list