• Nov 19, 2022 •CodeCatch
0 likes • 0 views
def print_pyramid_pattern(n): # outer loop to handle number of rows # n in this case for i in range(0, n): # inner loop to handle number of columns # values changing acc. to outer loop for j in range(0, i+1): # printing stars print("* ",end="") # ending line after each row print("\r") print_pyramid_pattern(10)
• Oct 4, 2023 •AustinLeath
0 likes • 10 views
weigh = lambda a,b: sum(b)-sum(a) FindCoin = lambda A: 0 if (n := len(A)) == 1 else (m := n//3) * (w := 1 + weigh(A[:m], A[2*m:])) + FindCoin(A[m*w:m*(w+1)]) print(FindCoin([1,1,1,1,1,1,1,2,1]))
# Python program for implementation of Selection # Sort import sys A = [64, 25, 12, 22, 11] # Traverse through all array elements for i in range(len(A)): # Find the minimum element in remaining # unsorted array min_idx = i for j in range(i+1, len(A)): if A[min_idx] > A[j]: min_idx = j # Swap the found minimum element with # the first element A[i], A[min_idx] = A[min_idx], A[i] # Driver code to test above print ("Sorted array") for i in range(len(A)): print("%d" %A[i]),
• Feb 23, 2025 •hasnaoui1
0 likes • 7 views
print("hello world")
• Jun 1, 2023 •CodeCatch
0 likes • 3 views
bytes_data = b'Hello, World!' string_data = bytes_data.decode('utf-8') print("String:", string_data)
• Jul 8, 2025 •AustinLeath
0 likes • 5 views
from datetime import datetime epoch_time = 1753823646 # Example epoch time (March 15, 2023 00:00:00 UTC) # Convert epoch time to a UTC datetime object utc_datetime = datetime.utcfromtimestamp(epoch_time) print(f"Epoch time: {epoch_time}") print(f"UTC datetime: {utc_datetime}") # You can also format the output string formatted_utc_time = utc_datetime.strftime('%m-%d-%Y %H:%M:%S UTC') print(f"Formatted UTC datetime: {formatted_utc_time}")