Question: Please help me to write this exercise in python. mplement stack (last in, first out). The program will read file VSTUP.TXT where on individual rows
Please help me to write this exercise in python.

mplement stack (last in, first out). The program will read file VSTUP.TXT where on individual rows there are prescried activities that should be executed: U-push, O-pop, P-print (list of the numbers ordered from top to bottom (newest value to oldest) separated by spaces and enclosed into brackets - e.g. "[32 ]"). The lines of input should be copied to standrad output. The copied command shoudl be followed by a line with output of given command if it makes sense. Such outputs are list of items already on the stack or data retrieved from the to of the stack. There can appear for example the following lines: U 2 with the meaning "insert 2 onto stack" p with the meaning "print entire stack" 0 with the meaning "fetch value from the stack and print it on standard output
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
