Queer European MD passionate about IT
Quellcode durchsuchen

changed last step solution and cleared output

Srini Kadamati vor 8 Jahren
Ursprung
Commit
015bea6a99
1 geänderte Dateien mit 10 neuen und 13 gelöschten Zeilen
  1. 10 13
      Mission207Solutions.ipynb

+ 10 - 13
Mission207Solutions.ipynb

@@ -52,21 +52,18 @@
    },
    "outputs": [],
    "source": [
+    "data_no_header = lines_list[1:len(lines_list)]\n",
     "days_counts = dict()\n",
-    "count = 0\n",
     "\n",
-    "for line in lines_list:\n",
-    "    if count != 0:\n",
-    "        split_line = line.split(\",\")\n",
-    "        day_of_week = split_line[3]\n",
-    "        num_births = int(split_line[4])\n",
-    "        \n",
-    "        if day_of_week in days_counts:\n",
-    "            days_counts[day_of_week] = days_counts[day_of_week] + num_births\n",
-    "        else:\n",
-    "            days_counts[day_of_week] = num_births\n",
-    "    if count == 0:\n",
-    "        count += 1\n",
+    "for line in data_no_header:\n",
+    "    split_line = line.split(\",\")\n",
+    "    day_of_week = split_line[3]\n",
+    "    num_births = int(split_line[4])\n",
+    "\n",
+    "    if day_of_week in days_counts:\n",
+    "        days_counts[day_of_week] = days_counts[day_of_week] + num_births\n",
+    "    else:\n",
+    "        days_counts[day_of_week] = num_births\n",
     "\n",
     "days_counts"
    ]