hello,

I am currently working on an assignment in my IPT class and I am trying to get questions from my questions box randomly. I am able to do the random function but I do not want them to repeat. My 'questions box' is a dictionary and I have also imported tkinter. Please do help as it is due soon. This is what I am currently doing to get random things:

 number = random.randint(0,len(Questions_Box)-1
 q = Questions_Box[number]
 random.shuffle(Questions_Box)

Recommended Answers

Using random.shuffle(), you can just then read them in order. http://www.tutorialspoint.com/python/number_shuffle.htm

Jump to Post

All 2 Replies

The easiest way would be to remove a question once it has been asked.

Be a part of the DaniWeb community

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