diff options
author | Zhongheng Liu on Homelab <z.liu@outlook.com.gr> | 2025-04-29 15:16:48 +0300 |
---|---|---|
committer | Zhongheng Liu on Homelab <z.liu@outlook.com.gr> | 2025-04-29 15:16:48 +0300 |
commit | 160136ce8d717e31e82365aac31737f77afe0adf (patch) | |
tree | 873700a6bf6aa6ca29cc912821c8ba73bd81b1d5 /past-papers/mj-2024/Question1_J24.py | |
parent | fa517a52b3b535dd905515a045d01552b1b51718 (diff) | |
download | cs-y13-160136ce8d717e31e82365aac31737f77afe0adf.tar.gz cs-y13-160136ce8d717e31e82365aac31737f77afe0adf.tar.bz2 cs-y13-160136ce8d717e31e82365aac31737f77afe0adf.zip |
moving into dedicated past-papers folder
Diffstat (limited to 'past-papers/mj-2024/Question1_J24.py')
-rw-r--r-- | past-papers/mj-2024/Question1_J24.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/past-papers/mj-2024/Question1_J24.py b/past-papers/mj-2024/Question1_J24.py new file mode 100644 index 0000000..c1b1629 --- /dev/null +++ b/past-papers/mj-2024/Question1_J24.py @@ -0,0 +1,20 @@ +global WordArray +global NumberWords +WordArray = [] +NumberWords = 0 +def ReadWords(filename: str): + with open(filename, 'r') as file: + WordArray = [line.strip('\n') for line in file.readlines()] + NumberWords = len(WordArray) - 1 + +choice = input("Difficulty: easy; medium; hard? : ") +if choice == "easy": + ReadWords("Easy.txt") +elif choice == "medium": + ReadWords("Medium.txt") +elif choice == "hard": + ReadWords("Hard.txt") + +def Play(): + print(f"{WordArray[0]}; number of answers: {NumberWords}") + while
\ No newline at end of file |