Question: Modify s to remove every other element, starting from the top-most element. Do NOT return a new stack. Modify the one that is given.

Modify s to remove every other element, starting from the top-most element. Do NOT return a new stack. Modify the one that is given. Precondition: There is at least one item in s. >>> s= Stack() >>>s.push('one') >>>s.push('two') >>>s.push('three') >>>s.push('four') >>>s.push('five') >>> remove_every_other(s) >>>s.pop() 'four' >>>s.pop() 'two' >>>s.is_empty() True www #TODO: Implement this method
Step by Step Solution
3.39 Rating (158 Votes )
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
