From 8446e1738d3fb759fd3bd11cef845f6568047240 Mon Sep 17 00:00:00 2001 From: Nid <151536002+aodisnfieu@users.noreply.github.com> Date: Sun, 14 Apr 2024 18:37:59 +0530 Subject: [PATCH] Update main.py #3 --- main.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/main.py b/main.py index 2920e9f..f7db47a 100644 --- a/main.py +++ b/main.py @@ -19,24 +19,27 @@ def main(): box = slots[box_idx] q, a = box.pop(n // box_chance_mul[box_idx]) print(chr(27) + "[2J") - # print(box_idx, f, n) - print(q) + + print("====================================") + print(" Flashcard ") + print("====================================") + print(f"Question: {q}") print("-" * 4) input("Answer: ") - o = input(f"The answer was: {a}\nWere you correct? (Y/n/exit): ") + print(f"The answer was: {a}") print("=" * 5) - if not o or o[0].lower() == "y": + + if not input("Were you correct? (Y/n/exit): ").strip()[:1].lower() in ["n", ""]: box_idx = min(box_idx + 1, len(slots) - 1) - elif o[0].lower() == "n": - box_idx = max(box_idx - 1, 0) else: - break + box_idx = max(box_idx - 1, 0) + slots[box_idx].append((q, a)) + if len(cards) == len(slots[-1]): print(f"You have memorised all {len(cards)} cards") - k = input("Exit? (N/y): ") - if o and o[0].lower() == "y": + if input("Exit? (N/y): ").strip()[:1].lower() == "y": break if __name__ == "__main__": - main() \ No newline at end of file + main()