Any practice exercises for beginner???
DaveMoore
djmoore at uh.edu
Wed Jan 31 18:39:12 EST 2001
On Wed, 31 Jan 2001 21:36:22 GMT, "shaka" <fabrice.n at home.com> wrote:
>
> I was just wondering beside the tutorial if there was any practice
>exercises to reinforce beginners strength in python?
>I can recall that when learning Java, some Java website offered some
>exercises for beginners.
>
First of all, check out the Useless Python Page:
<http://www.lowerstandard.com/python/pythonsource.html>.
Download and run the code, see what it does, then try to duplicate it.
There is a link there to the Association for Computing Machinery
Collegiate Programming Contest Problem Set Archive, but it's
been updated:
http://acm.uva.es/problemset/
(Note that contest entries must be in C/C++ or Pascal.)
(Great Grotty Ghu, this thing has an automated on-line
judge! I bet that's a pretty piece of code!)
Here's a problem I recently had fun with:
Many of the Win32 Network Resource enumeration tools return a list of
dictionaries:
[{'name':'comp1','comment':'room 100','type':WKSTATION},
{'name':'comp2','comment':'room 101','type':SERVER}]
Try converting this to a dictionary of lists:
{'comp1':['room100',WKSTATION],'comp2':['room 101',SERVER]}
(Typed by hand, hope I got the punctuation right.)
Now step through the dictionary, printing out the characteristics
associated with each computer in a neatly-formatted table.
Hm, didn't come out in order, did it? Fix that.
It's interesting to do this with a large (15-20 entries), sorted
list(the Win32 functions return a list sorted by computer name); if
you print the result dictionary out as each entry is added, you can
watch the dictionary reorganize itself as it grows.
(This is as far as I got, I'm interested in the enumerated resources,
and this turns out not to be the best way to do what I want. But it
was an educational exercise.)
If you have a lot of time to waste, er, invest, write a wrapper that
solicits input to fill the source list, and then lets you search the
resulting dictionary for a particular entry. Duplicates of
already-existing entries should be handled gracefully. If you're
really ambitious, provide a mechanism to edit and delete entries as
well.
OK, now re-write the interface so it uses Tk/Tcl dialogs instead of a
text-based interface.
--
Dave Moore == djmoore at uh.edu == I speak for me.
In the wrong hands, sanity is a dangerous weapon.
More information about the Python-list
mailing list