+ 1

Question Randomizer

How would you go about making a program that randomizes questions every time the user presses Enter? The questions would be manually entered and it could be used as a study tool. Also, I’m learning Python so that’s the language I’d like to use.

2nd Oct 2018, 10:43 AM
Jeff
Jeff - avatar
5 Respostas
+ 3
put then into an array myarray and use random.choice(myarray).
2nd Oct 2018, 11:25 AM
Oma Falk
Oma Falk - avatar
+ 3
Daniele Bonomi or read that file into an array. and after rc.
2nd Oct 2018, 11:50 AM
Oma Falk
Oma Falk - avatar
+ 2
I would create a file where there is a question on each line and then find a random number, get to that line and print the line
2nd Oct 2018, 11:23 AM
Daniele Bonomi
Daniele Bonomi - avatar
+ 1
If you want to iterate through the questions, you can also use random.shuffle on the list, mixing it up, then iterate from the start.
2nd Oct 2018, 2:08 PM
HonFu
HonFu - avatar
+ 1
I think random module will help you. check this. https://youtu.be/KzqSDvzOFNA
2nd Oct 2018, 3:59 PM
Maninder $ingh
Maninder $ingh - avatar