From 5f46aa78cbab35d6265ec33db895ff2e132d7e79 Mon Sep 17 00:00:00 2001 From: DMInnovations <133730558+DMInnovations@users.noreply.github.com> Date: Fri, 22 Dec 2023 16:32:52 -0700 Subject: [PATCH] v3.0 --- Algorthmic Tests/primeCounter.py | 67 +++++++++++++++++++++++++++ Algorthmic Tests/waveFunction.py | 4 +- Simple Tests/addTest.py | 2 +- Simple Tests/allBasicMath.py | 2 +- Simple Tests/divideTest.py | 2 +- Simple Tests/forBreakTest.py | 2 +- Simple Tests/forTest.py | 2 +- Simple Tests/input.py | 2 +- Simple Tests/mulitplyTest.py | 2 +- Simple Tests/subText.py | 2 +- Sorting Tests/bubbleSort.py | 2 +- Sorting Tests/greatestAndLeastSort.py | 2 +- Sorting Tests/mergeSort.py | 2 +- Sorting Tests/selectionSort.py | 2 +- 14 files changed, 81 insertions(+), 14 deletions(-) create mode 100644 Algorthmic Tests/primeCounter.py diff --git a/Algorthmic Tests/primeCounter.py b/Algorthmic Tests/primeCounter.py new file mode 100644 index 0000000..185920e --- /dev/null +++ b/Algorthmic Tests/primeCounter.py @@ -0,0 +1,67 @@ +import time +import numpy as np + + +# --- Prime Function --- # +primeList = [] +def primeCounter(countUpTo): + list = [x for x in range(0,countUpTo)] + + # Get the value in the list + for i in range(len(list)): + # From 2 to the value, check to see if it is a prime; if the remainder is zero, not a prime; else, append prime number to the primeList + for k in range(2, i): + if i % k == 0: + break + else: + primeList.append(i) + + print(primeList) + +# --- Primes to 100 --- # +# Start timer +startTimer = time.perf_counter() +startTimer2 = time.process_time() + +primeCounter(101) + +endTimer = time.perf_counter() +endTimer2 = time.process_time() + +print(f"Task Finished In Performance: {endTimer - startTimer:0.8f}s\nTask Finished In Process/CPU/Kernel + User Space: {endTimer2 - startTimer2:0.8f}s") + +# --- Primes to 1000 --- # +# Start timer +startTimer = time.perf_counter() +startTimer2 = time.process_time() + +primeCounter(1001) + +endTimer = time.perf_counter() +endTimer2 = time.process_time() + +print(f"Task Finished In Performance: {endTimer - startTimer:0.8f}s\nTask Finished In Process/CPU/Kernel + User Space: {endTimer2 - startTimer2:0.8f}s") + +# --- Primes to 10000 --- # +# Start timer +startTimer = time.perf_counter() +startTimer2 = time.process_time() + +primeCounter(10001) + +endTimer = time.perf_counter() +endTimer2 = time.process_time() + +print(f"Task Finished In Performance: {endTimer - startTimer:0.8f}s\nTask Finished In Process/CPU/Kernel + User Space: {endTimer2 - startTimer2:0.8f}s") + +# --- Primes to 1000000 --- # +# Start timer +startTimer = time.perf_counter() +startTimer2 = time.process_time() + +primeCounter(1000001) + +endTimer = time.perf_counter() +endTimer2 = time.process_time() + +print(f"Task Finished In Performance: {endTimer - startTimer:0.8f}s\nTask Finished In Process/CPU/Kernel + User Space: {endTimer2 - startTimer2:0.8f}s") \ No newline at end of file diff --git a/Algorthmic Tests/waveFunction.py b/Algorthmic Tests/waveFunction.py index 7e4922e..d2f26d1 100644 --- a/Algorthmic Tests/waveFunction.py +++ b/Algorthmic Tests/waveFunction.py @@ -27,7 +27,7 @@ def waveFunc(loopNum): step2 = float((i * h) * (2 / 2 * t)) # Get the final value - print(f"SE: {step1 - step2}\n") + print(f"SE: {step1 - step2}s\n") # Run the function with a specific amount of times it will have to repeat the loop waveFunc(None) @@ -35,4 +35,4 @@ def waveFunc(loopNum): 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 +print(f"Task Finished In Performance: {endTimer - startTimer:0.8f}s\nTask Finished In Process/CPU/Kernel + User Space: {endTimer2 - startTimer2:0.8f}s") \ No newline at end of file diff --git a/Simple Tests/addTest.py b/Simple Tests/addTest.py index db53168..7b7b60e 100644 --- a/Simple Tests/addTest.py +++ b/Simple Tests/addTest.py @@ -18,4 +18,4 @@ 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 +print(f"Task Finished In Performance: {endTimer - startTimer:0.8f}s\nTask Finished In Process/CPU/Kernel + User Space: {endTimer2 - startTimer2:0.8f}s") \ No newline at end of file diff --git a/Simple Tests/allBasicMath.py b/Simple Tests/allBasicMath.py index 49b8864..93db03d 100644 --- a/Simple Tests/allBasicMath.py +++ b/Simple Tests/allBasicMath.py @@ -31,4 +31,4 @@ 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 +print(f"Task Finished In Performance: {endTimer - startTimer:0.8f}s\nTask Finished In Process/CPU/Kernel + User Space: {endTimer2 - startTimer2:0.8f}s") \ No newline at end of file diff --git a/Simple Tests/divideTest.py b/Simple Tests/divideTest.py index 6303d64..7df5011 100644 --- a/Simple Tests/divideTest.py +++ b/Simple Tests/divideTest.py @@ -21,4 +21,4 @@ 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 +print(f"Task Finished In Performance: {endTimer - startTimer:0.8f}s\nTask Finished In Process/CPU/Kernel + User Space: {endTimer2 - startTimer2:0.8f}s") \ No newline at end of file diff --git a/Simple Tests/forBreakTest.py b/Simple Tests/forBreakTest.py index baa9d34..46bfb6e 100644 --- a/Simple Tests/forBreakTest.py +++ b/Simple Tests/forBreakTest.py @@ -26,4 +26,4 @@ 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 +print(f"Task Finished In Performance: {endTimer - startTimer:0.8f}s\nTask Finished In Process/CPU/Kernel + User Space: {endTimer2 - startTimer2:0.8f}s") \ No newline at end of file diff --git a/Simple Tests/forTest.py b/Simple Tests/forTest.py index a5ffb71..6dfbb3f 100644 --- a/Simple Tests/forTest.py +++ b/Simple Tests/forTest.py @@ -19,4 +19,4 @@ 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 +print(f"Task Finished In Performance: {endTimer - startTimer:0.8f}s\nTask Finished In Process/CPU/Kernel + User Space: {endTimer2 - startTimer2:0.8f}s") \ No newline at end of file diff --git a/Simple Tests/input.py b/Simple Tests/input.py index 2cebf59..a1e11ab 100644 --- a/Simple Tests/input.py +++ b/Simple Tests/input.py @@ -14,4 +14,4 @@ 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 +print(f"Task Finished In Performance: {endTimer - startTimer:0.8f}s\nTask Finished In Process/CPU/Kernel + User Space: {endTimer2 - startTimer2:0.8f}s") \ No newline at end of file diff --git a/Simple Tests/mulitplyTest.py b/Simple Tests/mulitplyTest.py index 541898a..573c3d4 100644 --- a/Simple Tests/mulitplyTest.py +++ b/Simple Tests/mulitplyTest.py @@ -18,4 +18,4 @@ 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 +print(f"Task Finished In Performance: {endTimer - startTimer:0.8f}s\nTask Finished In Process/CPU/Kernel + User Space: {endTimer2 - startTimer2:0.8f}s") \ No newline at end of file diff --git a/Simple Tests/subText.py b/Simple Tests/subText.py index 57e4989..cce3599 100644 --- a/Simple Tests/subText.py +++ b/Simple Tests/subText.py @@ -21,4 +21,4 @@ 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 +print(f"Task Finished In Performance: {endTimer - startTimer:0.8f}s\nTask Finished In Process/CPU/Kernel + User Space: {endTimer2 - startTimer2:0.8f}s") \ No newline at end of file diff --git a/Sorting Tests/bubbleSort.py b/Sorting Tests/bubbleSort.py index 4b2c41d..915464f 100644 --- a/Sorting Tests/bubbleSort.py +++ b/Sorting Tests/bubbleSort.py @@ -14,4 +14,4 @@ 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 +print(f"Task Finished In Performance: {endTimer - startTimer:0.8f}s\nTask Finished In Process/CPU/Kernel + User Space: {endTimer2 - startTimer2:0.8f}s") \ No newline at end of file diff --git a/Sorting Tests/greatestAndLeastSort.py b/Sorting Tests/greatestAndLeastSort.py index 8c135a1..992685f 100644 --- a/Sorting Tests/greatestAndLeastSort.py +++ b/Sorting Tests/greatestAndLeastSort.py @@ -49,4 +49,4 @@ def mergeSort(array = []): 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 +print(f"Task Finished In Performance: {endTimer - startTimer:0.8f}s\nTask Finished In Process/CPU/Kernel + User Space: {endTimer2 - startTimer2:0.8f}s") \ No newline at end of file diff --git a/Sorting Tests/mergeSort.py b/Sorting Tests/mergeSort.py index 2e38643..9d6fc2e 100644 --- a/Sorting Tests/mergeSort.py +++ b/Sorting Tests/mergeSort.py @@ -47,4 +47,4 @@ def mergeSort(array = []): 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 +print(f"Task Finished In Performance: {endTimer - startTimer:0.8f}s\nTask Finished In Process/CPU/Kernel + User Space: {endTimer2 - startTimer2:0.8f}s") \ No newline at end of file diff --git a/Sorting Tests/selectionSort.py b/Sorting Tests/selectionSort.py index 53e4938..5827a62 100644 --- a/Sorting Tests/selectionSort.py +++ b/Sorting Tests/selectionSort.py @@ -23,4 +23,4 @@ def selectionSort(array = []): 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 +print(f"Task Finished In Performance: {endTimer - startTimer:0.8f}s\nTask Finished In Process/CPU/Kernel + User Space: {endTimer2 - startTimer2:0.8f}s") \ No newline at end of file