From a063aae4757b3bca17982a852678b6a84f87545a Mon Sep 17 00:00:00 2001 From: Peter Norvig Date: Tue, 19 Sep 2017 19:33:23 -0700 Subject: [PATCH] Add files via upload --- Cheryl-and-Eve.ipynb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Cheryl-and-Eve.ipynb b/Cheryl-and-Eve.ipynb index 87ac7e2..48808f7 100644 --- a/Cheryl-and-Eve.ipynb +++ b/Cheryl-and-Eve.ipynb @@ -100,7 +100,7 @@ "# the month and the day of the birthday respectively.\n", "\n", "def tell(part):\n", - " \"Cheryl tells a part of her birthdate; return a new set of possible dates that match the part.\"\n", + " \"Cheryl tells a part of her birthdate; return a subset of DATES that match the part.\"\n", " return {date for date in DATES if part in date}\n", "\n", "def know(possible_dates):\n", @@ -502,13 +502,13 @@ "outputs": [], "source": [ "def cheryls_birthday_with_eve(dates):\n", - " \"Return a list of the possible dates for which Albert, Bernard, and Eve's statements are true.\"\n", + " \"Return a set of the dates for which Albert, Bernard, and Eve's statements are true.\"\n", " return hear(using(dates), albert1, bernard1, albert2, eve1)\n", "\n", "def eve1(date):\n", " \"\"\"Eve: I peeked and saw the first letter of the month and the first digit of the day. \n", - " When I peeked, I didn't know Cheryl's birthday, but after listening to Albert and Bernard I do. \n", - " And it's a good thing I peeked, because otherwise I couldn't have figured it out.\"\"\"\n", + " When I peeked, I didn't know Cheryl's birthday, but after listening to Albert and Bernard \n", + " I do. And it's a good thing I peeked, because otherwise I couldn't have figured it out.\"\"\"\n", " at_first = tell(first(day(date))) & tell(first(month(date)))\n", " otherwise = tell('')\n", " return (not know(at_first) and\n", @@ -630,7 +630,7 @@ "outputs": [], "source": [ "def cheryls_birthday_complex(dates):\n", - " \"Return a list of the possible dates for which Albert, Bernard, and Eve's statements are true.\"\n", + " \"Return a set of the dates for which Albert, Bernard, and Eve's statements are true.\"\n", " return hear(using(dates), albert1, bernard1, albert2c, eve1c, albert3c)\n", "\n", "def albert2c(date):\n", @@ -639,8 +639,8 @@ "\n", "def eve1c(date):\n", " \"\"\"Eve: I peeked and saw the first letter of the month and the first digit of the day. \n", - " When I peeked, I didn't know Cheryl's birthday, but after listening to Albert and Bernard I do. \n", - " And it's a good thing I peeked, because otherwise I couldn't have figured it out.\"\"\"\n", + " When I peeked, I didn't know Cheryl's birthday, but after listening to Albert and Bernard \n", + " I do. And it's a good thing I peeked, because otherwise I couldn't have figured it out.\"\"\"\n", " at_first = tell(first(day(date))) & tell(first(month(date)))\n", " otherwise = tell('')\n", " return (not know(at_first)\n",