print("Array Deletion Menu (Python Program)")
arr = list(map(int, input("Enter elements: ").split()))
print("\nChoose Deletion Type:")
print("1. Delete from Beginning")
print("2. Delete from End")
print("3. Delete from Specific Position")
choice = int(input("Enter choice: "))
if choice == 1:
arr.pop(0)
elif choice == 2:
arr.pop()
elif choice == 3:
pos = int(input("Enter position: "))
arr.pop(pos)
else:
print("Invalid choice!")
print("\nArray after deletion:")
print(arr)
First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.
Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.