Searching for Lottery drawing list of ticket match...
tdsimpson at gmail.com
Wed Aug 10 20:55:27 CEST 2011
I need a little nudge into the right direction with this problem.
As an exercise for me to learn about Python, I am trying to determine
the best way to search a list of "lottery drawings" for a match with a
Possible numbers for a drawing are:
5 whiteballs (wb): 1-55
1 blackball (bb): 1-49
example: wb1, wb2, wb3, wb4, wb5, bb
Example list of lottery drawings:
Typically a lottery ticket can have multiple combinations for the
ticket to be a winner. For example:
2 wb, 1 bb
3 wb, 1 bb
4 wb, 1 bb
5 wb, 1 bb (jackpot winner)
An object oriented solution might be to create a list of "Drawing"
objects and then loop through the list to find a match for the ticket
object. For example:
if oDrawing[x] == ticket then "Do XYZ"
Or I could just perform this task with procedures and loops and skip
the object solution idea.
Do Python developers have a preference?
Would it be worth the overhead to initialize a list of drawing objects
to search through?
There is no database back-end, so no SQL, etc.
I hope all that makes sense.
Thanks for you help.
More information about the Python-list