This is a small project designed to randomize the order of multiple choice questions and their answers using Python.
- shuffle.py: A script used to take a
.txt
file with questions and answers, randomize questions and answers within questions, and produce a.docx
file. - bubble.py: A script to produce a bubble sheet with fill in spaces for each answer to each question
- example: A folder with an example input and output exam
- Produce a .txt file with each question and associated answers in this format:
Q.1. Text for question 1
a. Answer a
b. Answer b
c. Answer c
d. Answer d
e. Answer e
- Edit this line in
shuffle.py
, replacing "yourfile.txt" with the name of the file from step 1:
# Open the text file and read the lines
with open('yourfile.txt', 'r') as file:
lines = file.readlines()
- Run the
python shuffle.py
and it will produce 'shuffled_questions.docx', which can then be edited formatted as needed.
- Edit this line to include the number of questions and the possible choices for your exam.
# Define the number of questions and choices
num_questions = 50
choices = ['a', 'b', 'c', 'd', 'e']
- Run
python bubble.py
and 'bubble_sheet.docx' will be produced.