Add files via upload

This commit is contained in:
Peter Norvig
2020-05-21 14:26:41 -07:00
committed by GitHub
parent 501774ab53
commit 3832318b00

View File

@@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"<div align=\"right\" style=\"text-align: right\"><i>Peter Norvig<br>April 2015<br>Python 3: Feb 2019<br>Steve's bus: Apr 2020</i></div>\n",
"<div align=\"right\" style=\"text-align: right\"><i>Peter Norvig<br>April 2015<br>Python 3: Feb 2019<br>Steve's bus: Apr 2020<br>Mad Cheryl: May 2020</i></div>\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": {