Question
def stack_to_array(stack, target): ------------------------------------------------------- Pops contents of stack into target. At finish, stack is empty. Top value of stack is at end of target,
def stack_to_array(stack, target): """ ------------------------------------------------------- Pops contents of stack into target. At finish, stack is empty. Top value of stack is at end of target, bottom value of stack is at beginning of target. Use: stack_to_array(stack, target) ------------------------------------------------------- Parameters: stack - a Stack object (Stack) target - a Python list (list) Returns: None ------------------------------------------------------- """
NOTE: I already have:
while not stack.is_empty(): target.append(stack.pop()) return stack,target
But it gives me
"Test with array: '[11, 22, 33, 44, 55, 66]'
ERROR:
Expects stack with: [11, 22, 33, 44, 55, 66]" That's what I'm trying to fix
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started