DSA Pratice problems

1.Count the occurrence of each element from a list

sample_list = [11, 45, 8, 11, 23, 45, 23, 45, 89]

  1. Find the intersection (common) of two sets and remove those elements from the first set

first_set = {23, 42, 65, 57, 78, 83, 29}
second_set = {57, 83, 29, 67, 73, 43, 48}

3.Create a list by picking an odd-index items from the first list and even index items from the second list

l1 = [3, 6, 9, 12, 15, 18, 21]
l2 = [4, 8, 12, 16, 20, 24, 28]

  1. Write a program to remove the item present at index 4 and add it to the 2nd position and at the end of the list.

  2. Slice list into 3 equal chunks and reverse each chunk