From 4afcfa102e80e4282599f4fb96cc060d0a3d248c Mon Sep 17 00:00:00 2001 From: Jonathan Erlich <35579235+joerlop@users.noreply.github.com> Date: Fri, 15 Nov 2019 14:48:21 -0500 Subject: [PATCH] Fix op_2rot function in op.py Function should move 5th and 6th items back in the stack to the top of the stack, not copy them. Stack should remain the same size. --- code-ch13/op.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code-ch13/op.py b/code-ch13/op.py index 4e9e3831..e675c889 100644 --- a/code-ch13/op.py +++ b/code-ch13/op.py @@ -285,7 +285,7 @@ def op_2over(stack): def op_2rot(stack): if len(stack) < 6: return False - stack.extend(stack[-6:-4]) + stack[-6:] = stack[-4:] + stack[-6:-4] return True