I'm a teacher, and in a few days I have to give my students a test. Now, I'm always worried about my loveliest students being hurt by the least loveliest ones when they cheat, so I want to randomize the tests so no one can cheat off of anyone.
Right now, I have my tests saved in this format:
When was Java invented? Why does this matter? 1941 War was beginning None of the above What is the increment operator in Java? Stack Overflow>how 2 incrememnt Google>how 2 incrememnt increment ++
That is, the questions are separated by a single blank line, and the answers are all preceded by two spaces. This is the output I need:
What is the increment operator in Java? ++ increment Google>how 2 incrememnt Stack Overflow>how 2 incrememnt When was Java invented? War was beginning 1941 Why does this matter? None of the above
That is, each answer on a question in a random order, and the question order randomized as well. Keep in mind that if the answer choice is "None of the above", it should stay at the bottom. Every question always has exactly four answers, and "None of the above" only ever appears as the last answer choice -- and never appears as a substring of an answer choice that is not "None of the above". Unfortunately, I can't rewrite all of my tests, so you'll have to take them in that format. Also, my students have to be able to read it, so I can't really take output any other way (except as described below).
I don't need it to be perfectly random. As long as it's close.
Standard loopholes are banned.
Now, my students are used to that plain format, but if you can make it look like this...
1. What is the increment operator in Java? A. ++ B. increment C. Google>how 2 incrememnt D. Stack Overflow>how 2 incrememnt 2. When was Java invented? A. War was beginning B. 1941 C. Why does this matter? D. None of the above
I'll take 25% off of your final score. You'll get input the same way, though.
That is, if you number the questions and label the answers. Please keep in mind that questions should start at 1, and the answers are from A to D.
NB: The examples are different from the ones in the answers because I changed them after the fact. The specific examples aren't the point anyway; answers had to work with any arbitrary question(s).