aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2024-02-29 11:45:12 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2024-02-29 11:45:12 +0100
commit75ea836b7d062ef60d307a34b11919178e48b540 (patch)
tree655242a22de2c07c7d877b7361d58849ff70ea73
parent083e76d71126fd7a32359675a63366c10f76ace1 (diff)
downloadquiz-75ea836b7d062ef60d307a34b11919178e48b540.tar.gz
quiz-75ea836b7d062ef60d307a34b11919178e48b540.zip
add option to present questions in order
-rwxr-xr-xquiz.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/quiz.py b/quiz.py
index 6c2d3a9..943cb4c 100755
--- a/quiz.py
+++ b/quiz.py
@@ -216,6 +216,10 @@ def main():
parser.add_argument('--answers',
help='match question files names',
nargs='*')
+ parser.add_argument('-nr',
+ '--no-random',
+ help='Do not randomize questions',
+ action='store_true')
args = parser.parse_args()
question_dirs = [Path(p) for p in args.question_dir or ['.']]
@@ -234,7 +238,10 @@ def main():
solved = []
while questions:
- next_question = random.choice(questions)
+ if args.no_random:
+ next_question = questions[0]
+ else:
+ next_question = random.choice(questions)
solution = solutions[f'{next_question.parent / next_question.stem}']
print(f'{next_question}: {solution}', end='')