From 7d97f40ed017a20dda3d7fa63f48e64dae479e6c Mon Sep 17 00:00:00 2001 From: DMInnovations Date: Wed, 29 Nov 2023 15:21:20 -0700 Subject: [PATCH] Added Medium Ranking Tests --- Medium Tests/forBreakTest.py | 29 +++++++++++++++++++++++++++++ Medium Tests/forTest.py | 22 ++++++++++++++++++++++ Medium Tests/sortTest.py | 17 +++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 Medium Tests/forBreakTest.py create mode 100644 Medium Tests/forTest.py create mode 100644 Medium Tests/sortTest.py diff --git a/Medium Tests/forBreakTest.py b/Medium Tests/forBreakTest.py new file mode 100644 index 0000000..baa9d34 --- /dev/null +++ b/Medium Tests/forBreakTest.py @@ -0,0 +1,29 @@ +import time + + +# Start timer +startTimer = time.perf_counter() +startTimer2 = time.process_time() + +# List to cycle through +theList = ["a", "b", "i", "c", "d", "e", "n", "h", "j", ".", "m", "n", "l", "o", "t", "."] + +# Start "for" loop to separate values in the list, theList +separation = "." +tempList = [] +finalList = [] +for i in theList: + if i == ".": + tempList.append(i) + finalList.append(tempList) + tempList = [] + else: + tempList.append(i) + +# Append tempList to finalList +finalList.append(tempList) + +endTimer = time.perf_counter() +endTimer2 = time.process_time() + +print(f"Task Finished In Performance: {endTimer - startTimer:0.8f}\nTask Finished In Process/CPU/Kernel + User Space: {endTimer2 - startTimer2:0.8f}") \ No newline at end of file diff --git a/Medium Tests/forTest.py b/Medium Tests/forTest.py new file mode 100644 index 0000000..a5ffb71 --- /dev/null +++ b/Medium Tests/forTest.py @@ -0,0 +1,22 @@ +import time + + +# Start timer +startTimer = time.perf_counter() +startTimer2 = time.process_time() + +# List to cycle through +theList = ["a", "b", "i", "c", "d", "e", "n", "h", "j", ".", "m", "n", "l", "o", "t", "."] + +# Start "for" loop +for i in theList: + if i != ".": + continue + else: + print(i) + break + +endTimer = time.perf_counter() +endTimer2 = time.process_time() + +print(f"Task Finished In Performance: {endTimer - startTimer:0.8f}\nTask Finished In Process/CPU/Kernel + User Space: {endTimer2 - startTimer2:0.8f}") \ No newline at end of file diff --git a/Medium Tests/sortTest.py b/Medium Tests/sortTest.py new file mode 100644 index 0000000..acc8bae --- /dev/null +++ b/Medium Tests/sortTest.py @@ -0,0 +1,17 @@ +import time + + +# Start timer +startTimer = time.perf_counter() +startTimer2 = time.process_time() + +# Random numbers in a list +theList = [4, 5, 1, 3, 6, 10, 8, 9, 11, 7, 20, 22, 13, 17, 18, 12, 16, 71] + +# Run sort +print(theList.sort()) + +endTimer = time.perf_counter() +endTimer2 = time.process_time() + +print(f"Task Finished In Performance: {endTimer - startTimer:0.8f}\nTask Finished In Process/CPU/Kernel + User Space: {endTimer2 - startTimer2:0.8f}") \ No newline at end of file