summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--very.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/very.py b/very.py
new file mode 100644
index 0000000..ed56487
--- /dev/null
+++ b/very.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python3
+
+import json
+import random
+
+
+def main():
+ dictionary = json.load(open("dict.json", mode="r", encoding="utf-8"))
+
+ correct = 0
+ for counter, (question, answer) in enumerate(random.sample(dictionary, len(dictionary))):
+ print(f"Very {question} -> ", end="")
+ try:
+ user_input = input()
+ except EOFError:
+ break
+ if user_input.lower() == answer.lower():
+ print("Correct!")
+ correct += 1
+ else:
+ print(f"Wrong! The answer was {answer}")
+
+
+ print(f"Result: {correct}/{counter}")
+
+
+if __name__ == "__main__":
+ main()