• Nov 19, 2022 •CodeCatch
0 likes • 0 views
# 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]),
• Nov 18, 2022 •AustinLeath
0 likes • 1 view
# List lst = [1, 2, 3, 'Alice', 'Alice'] # One-Liner indices = [i for i in range(len(lst)) if lst[i]=='Alice'] # Result print(indices) # [3, 4]
• Jun 1, 2023 •CodeCatch
0 likes • 2 views
filename = "data.txt" data = "Hello, World!" with open(filename, "a") as file: file.write(data)
• Jul 2, 2025 •AustinLeath
import calendar from datetime import datetime # Get the UTC timestamp a = calendar.timegm(datetime.utcnow().utctimetuple()) print(a)
• Jun 16, 2024 •lagiath
print('hello, world')
• May 31, 2023 •CodeCatch
import calendar # Prompt user for year and month year = int(input("Enter the year: ")) month = int(input("Enter the month: ")) # Create a calendar object cal = calendar.monthcalendar(year, month) # Display the calendar print(calendar.month_name[month], year) print("Mon Tue Wed Thu Fri Sat Sun") for week in cal: for day in week: if day == 0: print(" ", end="") else: print(str(day).rjust(2), " ", end="") print()