[Tutor] python dictionaries
Raven Of Night Raven Of Night
raistlen117 at msn.com
Sat Jan 6 00:43:56 CET 2007
Hi, there was this two step program I was working on but i can only complete
the first step.
- - Write a Who's Your Daddy? program that lets the user enter the name of
the male and produces the name of his father. Allow the user to add,
replace, and delete father son pairs. The program should also allow the user
to get a list of all son, fathers, or father son pairs.
I made a dictionary:
family = { "Wane Wilright" : "Dan Wilright",
"Michal Zheng" : "Tsu Zheng",
"Art Core" : "Vandalee Core",
"John Wane" : "Calvin Wane" }
and was able to complete the rest of the program.
Then I was asked to improve the program:
- - Improve the Who's Your Daddy program by adding a choice that lets the
user enter a name and get back a grandfather. Your program should still use
one dictionary of son-father pairs. Make sure to include several generatios
in your dictionary so that a match can be found.
I don't understand, dictionarys only allow two elements so how can you
include several generations in the dictinoary... could you perhaps put a
dictinoary inside a dictionary? I don't understand how you would do the
second part.
_________________________________________________________________
The MSN Entertainment Guide to Golden Globes is here. Get all the scoop.
http://tv.msn.com/tv/globes2007/?icid=nctagline2
More information about the Tutor
mailing list