diff --git a/ipynb/Cheryl.ipynb b/ipynb/Cheryl.ipynb index 0d7e0c6..75a68de 100644 --- a/ipynb/Cheryl.ipynb +++ b/ipynb/Cheryl.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "
Peter Norvig
April 2015
Python 3: Feb 2019
Steve's bus: Apr 2020
\n", + "
Peter Norvig
April 2015
Python 3: Feb 2019
Steve's bus: Apr 2020
Mad Cheryl: May 2020
\n", "\n", "# When is Cheryl's Birthday?\n", "\n", @@ -482,7 +482,7 @@ ], "source": [ "times = '06:32 06:43 06:50 07:17 07:46 08:19 08:32 09:17 09:19 09:50'.split()\n", - "dates = [t.replace(':', ' ') for t in times]\n", + "dates = [time.replace(':', ' ') for time in times]\n", "\n", "cheryls_birthday()" ] @@ -493,6 +493,47 @@ "source": [ "Steve took the 8:32 bus." ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Another New Puzzle: Evil Mad Scientist Cheryl\n", + "\n", + "![](https://norvig.com/images/cheryl-trolley.png)\n", + "\n", + "Again, we can solve this problem just by changing the format of `dates`:" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'C 3'}" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "pads = 'A2 A3 A6 B4 B5 C1 C3 D1 D2 D4'.split()\n", + "dates = [L+' '+N for L,N in pads]\n", + "\n", + "cheryls_birthday()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Mad scientist Cheryl was refering to pad C3. (But may I point out that this Cheryl is not actually a mad scientist, just a [mad engineer](https://www.evilmadscientist.com/2015/evil-mad-engineers/). A true mad scientist would kill 25 people and use the other 25 as a control group.)" + ] } ], "metadata": {