• Dec 18, 2025 •CodeCatch
0 likes • 3 views
def insertion_sort(arr): # Traverse through 1 to len(arr) for i in range(1, len(arr)): key = arr[i] # Move elements of arr[0..i-1], that are greater than key, # to one position ahead of their current position j = i - 1 while j >= 0 and key < arr[j]: arr[j + 1] = arr[j] j -= 1 arr[j + 1] = key # Example usage: arr = [12, 11, 13, 5, 6, 7, 8, 10] insertion_sort(arr) print("Sorted array is:", arr)
• Sep 20, 2025 •cntt.dsc-f4b6
1 like • 2 views
print(123)
• Nov 19, 2022 •CodeCatch
from math import pi def rads_to_degrees(rad): return (rad * 180.0) / pi rads_to_degrees(pi / 2) # 90.0
• Oct 7, 2022 •KETRICK
0 likes • 1 view
import pandas as pd x = pd.read_excel(FILE_NAME) print(x)
• May 31, 2023 •CodeCatch
0 likes • 0 views
class Rectangle: pass class Square(Rectangle): pass rectangle = Rectangle() square = Square() print(isinstance(rectangle, Rectangle)) # True print(isinstance(square, Rectangle)) # True print(isinstance(square, Square)) # True print(isinstance(rectangle, Square)) # False
# 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]),