From b57ca00bb2d8ecedd77c4a56bc59947a90fa9b97 Mon Sep 17 00:00:00 2001 From: Donne Martin Date: Mon, 6 Jul 2015 06:35:46 -0400 Subject: [PATCH] Changed sys.maxint to sys.maxsize for Python 3 compatibility. --- stacks_queues/stack_min/stack_min_challenge.ipynb | 5 ++--- stacks_queues/stack_min/stack_min_solution.ipynb | 7 +++---- stacks_queues/stack_min/test_stack_min.py | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/stacks_queues/stack_min/stack_min_challenge.ipynb b/stacks_queues/stack_min/stack_min_challenge.ipynb index 00bbad0..69e9467 100644 --- a/stacks_queues/stack_min/stack_min_challenge.ipynb +++ b/stacks_queues/stack_min/stack_min_challenge.ipynb @@ -34,10 +34,9 @@ "source": [ "## Constraints\n", "\n", - "* Can we assume this is a stack of ints?\n", " * Yes\n", - "* If we call this function on an empty stack, can we return max int?\n", + "* If we call this function on an empty stack, can we return maxsize?\n", " * Yes\n", "* Can we assume we already have a stack class that can be used for this problem?\n", " * Yes" @@ -158,7 +157,7 @@ " assert_equal(stack.pop(), 1)\n", " assert_equal(stack.min(), 5)\n", " assert_equal(stack.pop(), 5)\n", - " assert_equal(stack.min(), sys.maxint)\n", + " assert_equal(stack.min(), sys.maxsize)\n", "\n", " print('Test: Pop empty stack')\n", " assert_equal(stack.pop(), None)\n", diff --git a/stacks_queues/stack_min/stack_min_solution.ipynb b/stacks_queues/stack_min/stack_min_solution.ipynb index 493c286..df978eb 100644 --- a/stacks_queues/stack_min/stack_min_solution.ipynb +++ b/stacks_queues/stack_min/stack_min_solution.ipynb @@ -33,10 +33,9 @@ "source": [ "## Constraints\n", "\n", - "* Can we assume this is a stack of ints?\n", " * Yes\n", - "* If we call this function on an empty stack, can we return max int?\n", + "* If we call this function on an empty stack, can we return sys.maxsize?\n", " * Yes\n", "* Can we assume we already have a stack class that can be used for this problem?\n", " * Yes" @@ -127,7 +126,7 @@ "\n", " def min(self):\n", " if self.min_vals.top is None:\n", - " return sys.maxint\n", + " return sys.maxsize\n", " else:\n", " return self.min_vals.peek()\n", "\n", @@ -196,7 +195,7 @@ " assert_equal(stack.pop(), 1)\n", " assert_equal(stack.min(), 5)\n", " assert_equal(stack.pop(), 5)\n", - " assert_equal(stack.min(), sys.maxint)\n", + " assert_equal(stack.min(), sys.maxsize)\n", "\n", " print('Test: Pop empty stack')\n", " assert_equal(stack.pop(), None)\n", diff --git a/stacks_queues/stack_min/test_stack_min.py b/stacks_queues/stack_min/test_stack_min.py index e730921..8b475c2 100644 --- a/stacks_queues/stack_min/test_stack_min.py +++ b/stacks_queues/stack_min/test_stack_min.py @@ -26,7 +26,7 @@ class TestStackMin(object): assert_equal(stack.pop(), 1) assert_equal(stack.min(), 5) assert_equal(stack.pop(), 5) - assert_equal(stack.min(), sys.maxint) + assert_equal(stack.min(), sys.maxsize) print('Test: Pop empty stack') assert_equal(stack.pop(), None)