diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2024-02-29 11:45:12 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2024-02-29 11:45:12 +0100 |
| commit | 75ea836b7d062ef60d307a34b11919178e48b540 (patch) | |
| tree | 655242a22de2c07c7d877b7361d58849ff70ea73 /quiz.py | |
| parent | 083e76d71126fd7a32359675a63366c10f76ace1 (diff) | |
| download | quiz-75ea836b7d062ef60d307a34b11919178e48b540.tar.gz quiz-75ea836b7d062ef60d307a34b11919178e48b540.zip | |
add option to present questions in order
Diffstat (limited to 'quiz.py')
| -rwxr-xr-x | quiz.py | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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='') |
