[Tutor] Re: Ideas for beginning programs?

mjekl mjekl at clix.pt
Fri Jul 30 22:36:03 CEST 2004


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? 

1 - Guesser:
You can make python generate a random number for you if you import the random 
module. If you're not confortable with modules - it's easy as Py!

import <somemodule>
from <somemodule> import <somefunction or someclass>

And it's at your command!
Just think of a module as a file with function or class definitions that you 
can call into your programs to use at will (basically that's all I'm able to 
tell you since I'm a newbie)

If you don't want to use modules. You can make a list with many numbers and use 
it as the source for your (not very) secret number!

2 - Expand Guesser:
Instead as having the prg ask you for a number. Have two players, the computer 
against human. Each defining a secret number and the other one guessing.
Make a menu. Print results. This one can get pretty complex if you don't make 
it very structured.

3 - Write a program that gives asks you for temperature and the scale 
(Celcius / Farenheit) and then gives you the corresponding temperatures in 
(Farenheit / Celcius).

4 - Make a phone book using nested lists (or list and tuples)!
Use a menu to search a phone number by name or vice-versa

5 - Make a phone book using a simple list!
Use a menu to search a phone number by name or vice-versa

*Compare these phonebooks with a phonebook made with a dictionary*
*Make a version of Guesser using OOP*

Some tutorials on the net with example programs/tasks:
- Alan Gauld's tut
- Livewires
- "How to Think Like a Computer Cientist"
- ... there are others...

Going to try some of these myself ;-)
Best regards,
mjekl




More information about the Tutor mailing list