Tweaked python task 7
authorNeil Smith <neil.git@njae.me.uk>
Sat, 6 Oct 2018 19:21:57 +0000 (20:21 +0100)
committerNeil Smith <neil.git@njae.me.uk>
Sat, 6 Oct 2018 19:21:57 +0000 (20:21 +0100)
src/task7/task7.ipynb

index b7602610f26050666f02b891d21f7c72a6a18254..cecfa9123bf9e01fc25f6d664c02083a66500539 100644 (file)
@@ -2,7 +2,7 @@
  "cells": [
   {
    "cell_type": "code",
-   "execution_count": 10,
+   "execution_count": 25,
    "metadata": {},
    "outputs": [],
    "source": [
   },
   {
    "cell_type": "code",
-   "execution_count": 11,
+   "execution_count": 26,
    "metadata": {},
    "outputs": [],
    "source": [
     "def burnt_sorted(pancakes):\n",
-    "    return pancakes == sorted(pancakes)\n",
+    "    return all(p > 0 for p in pancakes) and pancakes == sorted(pancakes)\n",
     "\n",
     "def unburnt_sorted(pancakes):\n",
     "    simple_pancakes = [abs(p) for p in pancakes]\n",
@@ -34,7 +34,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 12,
+   "execution_count": 27,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -43,7 +43,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 13,
+   "execution_count": 28,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -53,7 +53,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 14,
+   "execution_count": 29,
    "metadata": {},
    "outputs": [
     {
@@ -62,7 +62,7 @@
        "69"
       ]
      },
-     "execution_count": 14,
+     "execution_count": 29,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -74,7 +74,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 15,
+   "execution_count": 30,
    "metadata": {},
    "outputs": [
     {
@@ -83,7 +83,7 @@
        "92"
       ]
      },
-     "execution_count": 15,
+     "execution_count": 30,
      "metadata": {},
      "output_type": "execute_result"
     }