I am a newb all the way around and I hope that I explain this thoroughly in order to get the help I need. I have a mysql db inside of my python program that generates a hint. I need to have a random number (which will later be transferred to a barcode/image) that prints to the next hint but links back to the previous hint. For example, the program hints, "This thing grows apples." You go to an apple tree and there is a barcode you scan to get the next hint. Each hint is unique but grouped by a location. What is the best way to link the number between the two hints?

5 Years
Discussion Span
Last Post by rrashkin

I'm not sure I follow. If it's a random number, then it won't point reliably in either direction, no? Is this maybe what you want?

There is a list of hints, lstHints. For each element of lstHints, there is a tuple, (n1,n2), where lstHints[n1] is that element and lstHints[n2] is the element you go to next. While it might seem that this is a dictionary, I don't think it is, as I am envisioning lstHints as being ordered and dictionaries are not. Basically it's two linked lists, one being lstHints and the other, say lstTuples.


I think this will work, I am going to try this. Thank you so much. Oh, btw, with it like this, the numbers dont have to be random. However, could I make a tuple of images, or would I have to make a table (in the db) and join both tables together?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.