Ad
  • Default User Avatar

    This solution is so clever and instructive at the same time. It taught so many of the python capabilities like the ones that you do in simple mathematical operations with slicing and especially the way you handle division!! I dont undertand a few things:

    1. in !. not stack[-1] will push True or False in stack. So, if we hade to face a dot wouldn't it raise an error? same for `

    2. How did you pass the Quine test? '>:# 0# # g# ,# 1# +# :# 5# 9# *# -# _@ Quine'. Lets see what I understand that happens step by step. Start--> :, stack[0] --> 0: stack[0,0] --> g: stack[62] --> ,: stack = [] output ='<' --> 1: stack[1] output='<' --> NOW THE PROBLEM +: stack OUT OF RANGE!
      Do I miss something? Alhtough, I can imagine many ways to fix this but the one I see would have to change all the slicing thing that you do in mathematical operations. I would recommend changing + like this stack.append(stack.pop() + stack.pop())

    3. the way that you implement moving, in the last for loop. Do we have to face the occasion where we get out of row or column limits like 'pacman'? To start from the beginnig of the row/col?