From 75ea836b7d062ef60d307a34b11919178e48b540 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Thu, 29 Feb 2024 11:45:12 +0100 Subject: add option to present questions in order --- quiz.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'quiz.py') 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='') -- cgit v1.2.3