[Tutor] Guidance on a Begginer Project.
Alan Gauld
alan.gauld at btinternet.com
Thu Jul 5 19:22:28 CEST 2007
"Tony Noyeaux" <tnoyeaux at msn.com> wrote
> ...could see upto 81 different outcomes 9x9So over all there would
> be 90 total outcomes listed in a table.
I'd probably go for a set of nested dictionaries (or maybe just lists)
and data drive the code. Thus the code becomes fairly trivial and
the complexity lies in the data, which is easily extended.
If you go down that rtoute think about the structure both in data
terms but also how you will layout the code in your file.
choices = { 1 :
{
A : {
X: 'Some Outcome',
Y : 'Some other'
}
B : {
P: 'Another',
Q: 'More'
}
}
2 :
{
C: ...etc...
}
Now the first choice (c1) is one of choices.keys()
The second choice (c2) is one of choices[c1].keys()
and the outcome is one of choices[c1][c2].keys()
You may need to tweak that but hopefully it gives some
kind of idea. Let the data structure guide the code for
problems of this type.
HTH,
Alan G.
More information about the Tutor
mailing list