Problem code ZCO14001 solution

I have written a program for problem code ZCO14001 and submitted it but it didn’t even pass one test case. The thing is the I think the program is correct and I was also able to get the correct output for the two sample cases when I enter them myself so even if it was not fully correct, I should have some test cases pass atleast.

class Controls:
    def __init__(self, end, max_h, stack):
        self.position = 0
        self.end = end
        self.stack = stack
        self.max = max_h
        self.is_loaded = False

    def move_left(self):
        if self.position > 0:
            self.position -= 1

    def move_right(self):
        if self.position < self.end-1:
            self.position += 1

    def pick(self):
        if self.stack[self.position] > 0 and not self.is_loaded:
            self.stack[self.position] -= 1
            self.is_loaded = True

    def drop(self):
        if self.stack[self.position] < self.max and self.is_loaded:
            self.stack[self.position] += 1
            self.is_loaded = False

line1 = input()
line1 = line1.split(" ")
stack_no = int(line1[0])
max_height = int(line1[1])

line2 = input()
line2 = list(map(int, line2.split(" ")))

while len(line2) < stack_no:

line3 = input()
line3 = list(map(int, line3.split(" ")))

controller = Controls(stack_no, max_height, line2)

for instruction in line3:
    if instruction == 0:
    elif instruction == 1:
    elif instruction == 2:
    elif instruction == 3:
    elif instruction == 4:


I am using python 3.6. Can anyone tell me if my program is incoreect or if it just isn’t formatted correctly? I am a noob so thanks for help.

From the above code, your output will be in list format: [0, 1, 2, 3] etc.

The requirement is for output as a space-separated list. You can achieve that easily by unpacking your .stack by prefixing an asterisk:

print( *controller.stack )

This feeds the iterable stack as a stream of parameters to the print function rather than as a single data item.

Thanks, It worked.