Queer European MD passionate about IT
Browse Source

fixed solution

yunoac 4 years ago
parent
commit
19b8fb1f5a
1 changed files with 11 additions and 21 deletions
  1. 11 21
      Mission481Solution.ipynb

+ 11 - 21
Mission481Solution.ipynb

@@ -103,8 +103,6 @@
    "metadata": {},
    "metadata": {},
    "outputs": [],
    "outputs": [],
    "source": [
    "source": [
-    "import csv                            \n",
-    "\n",
     "class Inventory():                    \n",
     "class Inventory():                    \n",
     "    \n",
     "    \n",
     "    def __init__(self, csv_filename):\n",
     "    def __init__(self, csv_filename):\n",
@@ -158,8 +156,6 @@
    "metadata": {},
    "metadata": {},
    "outputs": [],
    "outputs": [],
    "source": [
    "source": [
-    "import csv                            \n",
-    "\n",
     "class Inventory():                    \n",
     "class Inventory():                    \n",
     "    \n",
     "    \n",
     "    def __init__(self, csv_filename):\n",
     "    def __init__(self, csv_filename):\n",
@@ -293,8 +289,6 @@
    "metadata": {},
    "metadata": {},
    "outputs": [],
    "outputs": [],
    "source": [
    "source": [
-    "import csv                            \n",
-    "\n",
     "class Inventory():                    \n",
     "class Inventory():                    \n",
     "    \n",
     "    \n",
     "    def __init__(self, csv_filename):\n",
     "    def __init__(self, csv_filename):\n",
@@ -362,12 +356,10 @@
   },
   },
   {
   {
    "cell_type": "code",
    "cell_type": "code",
-   "execution_count": 5,
+   "execution_count": 4,
    "metadata": {},
    "metadata": {},
    "outputs": [],
    "outputs": [],
    "source": [
    "source": [
-    "import csv                            \n",
-    "\n",
     "class Inventory():                    \n",
     "class Inventory():                    \n",
     "    \n",
     "    \n",
     "    def __init__(self, csv_filename):\n",
     "    def __init__(self, csv_filename):\n",
@@ -424,7 +416,7 @@
   },
   },
   {
   {
    "cell_type": "code",
    "cell_type": "code",
-   "execution_count": 6,
+   "execution_count": 5,
    "metadata": {},
    "metadata": {},
    "outputs": [
    "outputs": [
     {
     {
@@ -453,15 +445,15 @@
   },
   },
   {
   {
    "cell_type": "code",
    "cell_type": "code",
-   "execution_count": 12,
+   "execution_count": 9,
    "metadata": {},
    "metadata": {},
    "outputs": [
    "outputs": [
     {
     {
      "name": "stdout",
      "name": "stdout",
      "output_type": "stream",
      "output_type": "stream",
      "text": [
      "text": [
-      "0.7781209945678711\n",
-      "0.0003719329833984375\n"
+      "0.3767249584197998\n",
+      "0.00017142295837402344\n"
      ]
      ]
     }
     }
    ],
    ],
@@ -470,22 +462,22 @@
     "\n",
     "\n",
     "inventory = Inventory('laptops.csv')                     # step 2\n",
     "inventory = Inventory('laptops.csv')                     # step 2\n",
     "\n",
     "\n",
-    "total_time_no_dict = 0                                   # step 3\n",
+    "total_time_no_set = 0                                    # step 3\n",
     "for price in prices:                                     # step 4\n",
     "for price in prices:                                     # step 4\n",
     "    start = time.time()                                  # step 4.1\n",
     "    start = time.time()                                  # step 4.1\n",
     "    inventory.check_promotion_dollars(price)             # step 4.2\n",
     "    inventory.check_promotion_dollars(price)             # step 4.2\n",
     "    end = time.time()                                    # step 4.3\n",
     "    end = time.time()                                    # step 4.3\n",
-    "    total_time_no_dict += end - start                    # step 4.4\n",
+    "    total_time_no_set += end - start                     # step 4.4\n",
     "    \n",
     "    \n",
-    "total_time_dict = 0                                      # step 5\n",
+    "total_time_set = 0                                       # step 5\n",
     "for price in prices:                                     # step 6\n",
     "for price in prices:                                     # step 6\n",
     "    start = time.time()                                  # step 6.1\n",
     "    start = time.time()                                  # step 6.1\n",
     "    inventory.check_promotion_dollars_fast(price)        # step 6.2\n",
     "    inventory.check_promotion_dollars_fast(price)        # step 6.2\n",
     "    end = time.time()                                    # step 6.3\n",
     "    end = time.time()                                    # step 6.3\n",
-    "    total_time_dict += end - start                       # step 6.4\n",
+    "    total_time_set += end - start                        # step 6.4\n",
     "    \n",
     "    \n",
-    "print(total_time_no_dict)                                # step 7\n",
-    "print(total_time_dict)"
+    "print(total_time_no_set)                                 # step 7\n",
+    "print(total_time_set)"
    ]
    ]
   },
   },
   {
   {
@@ -528,8 +520,6 @@
     }
     }
    ],
    ],
    "source": [
    "source": [
-    "import csv                            \n",
-    "\n",
     "def row_price(row):\n",
     "def row_price(row):\n",
     "    return row[-1]\n",
     "    return row[-1]\n",
     "\n",
     "\n",