# Python code to delete middle of a stack with iterative method# Deletes middle of stack of size n. Curr is current item numberdef deleteMid(st): n = len(st) tempSt = [] count = 0 # Put first n/2 element of st in tempSt while (count < (n / 2)-1): c = st[0] st.pop(0) tempSt.insert(0, c) count = count+1 # Delete middle element st.pop(0) # Put all (n/2) element of tempSt in st while (len(tempSt) != 0): st.insert(0, tempSt[0]) tempSt.pop(0)# Driver Codest = []# insert elements into the stackst.insert(0, 1)st.insert(0, 2)st.insert(0, 3)st.insert(0, 4)st.insert(0, 5)st.insert(0, 6)st.insert(0, 7)deleteMid(st)# Printing stack after deletion of middle.while (len(st) != 0): p = st[0] st.pop(0) print(p, " ")# This code is added by adityamaharshi21