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?

Recommended Answers

All 3 Replies

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?

I'm afraid I don't follow. What are you trying to accomplish?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.