python data structures in the english dictionarythe word stack means arranging objects one over another it is the same waymemory is allocated in this data structure it stores the data elements in similar fashion as bunch of plates are stored one above another in the kitchen sostack data structure allows operations at one endwhich can be called top of the stack we can add elements or remove elements only form this end of the stack in stack the element inserted last in sequencewill come out first as we can remove only from the top of the stack such feature is known as last in first out(lifofeature the operations of adding and removing the elements is known as push and pop in the following programwe implement it as add and remove functions we declare an empty list and use the append(and pop(methodsto add and remove the data elements push into stack let us understandhow to use push in stack refer the program mentioned program belowclass stackdef __init__(self)self stack [def add(selfdataval)use list append method to add element if dataval not in self stackself stack append(datavalreturn true elsereturn false use peek to look at the top of the stack def peek(self)return self stack[- astack stack(astack add("mon"astack add("tue"astack peek(