diff options
-rw-r--r-- | 9618-41-on-2023/Question1_N23.py | 20 | ||||
-rw-r--r-- | 9618-41-on-2023/Question2_N23.py | 51 | ||||
-rw-r--r-- | mj-2024/Easy.txt | 15 | ||||
-rw-r--r-- | mj-2024/Hard.txt | 98 | ||||
-rw-r--r-- | mj-2024/Medium.txt | 45 | ||||
-rw-r--r-- | mj-2024/Question1_J24.py | 20 |
6 files changed, 249 insertions, 0 deletions
diff --git a/9618-41-on-2023/Question1_N23.py b/9618-41-on-2023/Question1_N23.py new file mode 100644 index 0000000..2d8c9ac --- /dev/null +++ b/9618-41-on-2023/Question1_N23.py @@ -0,0 +1,20 @@ +def IterativeVowels(Value: str) -> int: + Total = 0 + LengthString = len(Value) + for X in range(LengthString): + FirstCharacter = Value[0] + if FirstCharacter == 'a' or FirstCharacter == 'e' or FirstCharacter == 'i' or FirstCharacter == 'o' or FirstCharacter == 'u': + Total += 1 + Value = Value[1:] + return Total +returnValue = IterativeVowels("house") +print(returnValue) +def RecursiveVowels(Value: str) -> int: + if len(Value) == 0: + return 0 + current = Value[0] + if current == 'a' or current == 'e' or current == 'i' or current == 'o' or current == 'u': + return 1 + RecursiveVowels(Value[1:]) + else: + return 0 + RecursiveVowels(Value[1:]) +print(RecursiveVowels("imagine")) diff --git a/9618-41-on-2023/Question2_N23.py b/9618-41-on-2023/Question2_N23.py new file mode 100644 index 0000000..a894c88 --- /dev/null +++ b/9618-41-on-2023/Question2_N23.py @@ -0,0 +1,51 @@ +Queue = [None for i in range(50)] +HeadPointer = -1 +TailPointer = 0 +def Enqueue(Value: str): + global TailPointer, HeadPointer, Queue + if HeadPointer == 49: + print("Queue is full") + return + HeadPointer += 1 + Queue[HeadPointer] = Value + print(Queue) +def Dequeue() -> str: + global TailPointer, HeadPointer, Queue + if TailPointer >= HeadPointer: + print("The queue is empty") + return "Empty" + returnValue = Queue[TailPointer] + Queue[TailPointer] = None + TailPointer += 1 + return returnValue + +def ReadData(): + with open("QueueData.txt", 'r') as queueData: + [Enqueue(line.strip()) for line in queueData.readlines()] + +class RecordData: + def __init__(self): + self.ID = None + self.Total = None +global Records +Records = [RecordData() for i in range(50)] +global NumberRecords +NumberRecords = 0 +def TotalData(): + global NumberRecords + DataAccessed = Dequeue() + Flag = False + if NumberRecords == 0: + Records[NumberRecords].ID = DataAccessed + Records[NumberRecords].Total = 1 + Flag = True + NumberRecords += 1 + else: + for x in range(NumberRecords): + if Records[X].ID == DataAccessed: + Records[X].Total = Records[X].Total + 1 + Flag = True + if Flag == False: + Records[NumberRecords].ID = DataAccessed + Records[NumberRecords].Total = 1 + NumberRecords += 1 diff --git a/mj-2024/Easy.txt b/mj-2024/Easy.txt new file mode 100644 index 0000000..d96fec4 --- /dev/null +++ b/mj-2024/Easy.txt @@ -0,0 +1,15 @@ +house +hues +hose +hoes +shoe +sou +ohs +ose +oes +sue +use +hue +hoe +hes +she
\ No newline at end of file diff --git a/mj-2024/Hard.txt b/mj-2024/Hard.txt new file mode 100644 index 0000000..bad9d90 --- /dev/null +++ b/mj-2024/Hard.txt @@ -0,0 +1,98 @@ +fainted +defiant +detain +fadein +nidate +anted +fated +fined +tined +defat +feint +teind +entia +fetid +tenia +faint +fiend +tinea +adit +daft +defi +diet +dite +fain +fend +fine +neif +tend +aide +date +deft +dine +edit +fane +feta +idea +nide +tide +ante +deaf +deni +dint +fate +fiat +naif +nite +tied +anti +dean +dent +dita +fade +feat +find +neat +tain +tine +aft +and +ate +die +eat +fad +fen +fin +nit +tea +tin +aid +ane +dan +dif +eft +fan +fet +fit +tad +ted +ain +ani +def +din +end +fat +fid +nae +tae +ten +ait +ant +den +dit +eta +fed +fie +net +tan +tie
\ No newline at end of file diff --git a/mj-2024/Medium.txt b/mj-2024/Medium.txt new file mode 100644 index 0000000..67074fa --- /dev/null +++ b/mj-2024/Medium.txt @@ -0,0 +1,45 @@ +direct +die +dit +ice +ire +rec +red +rei +ret +rid +ted +tic +tie +cedi +cire +cite +dice +diet +dire +dirt +dite +edit +etic +iced +ired +rice +ride +rite +tide +tied +tier +tire +cider +cited +citer +cried +dicer +edict +recti +riced +tired +trice +tried +credit +triced
\ No newline at end of file diff --git a/mj-2024/Question1_J24.py b/mj-2024/Question1_J24.py new file mode 100644 index 0000000..c1b1629 --- /dev/null +++ b/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 |