Skip to content

Instantly share code, notes, and snippets.

View Delation's full-sized avatar

Yeti Delation

  • behind you
  • 06:13 (UTC +01:00)
View GitHub Profile
@Delation
Delation / list_sort.py
Last active April 10, 2024 16:37
Practice sorting lists for my Computer Science class
import random, time
### Test case functions
# Check for sorted list
def is_sorted(a:list) -> bool:
for i in range(len(a) - 1):
if a[i] > a[i + 1]:
return False
return True
@Delation
Delation / pythag.py
Last active November 2, 2023 00:57
Pythagorean Tripes
import math
def brute_search(recursion_depth:int = 200):
nums = list(range(recursion_depth))
i = 1
while i < len(nums):
a = nums[i]
for b in range(a, recursion_depth):
c = math.sqrt(a**2 + b**2) # Pythagorean theorem
if c.is_integer():