Cheryl's birthday: Difference between revisions

Content added Content deleted
(→‎Functional Python: Minor tidying, reordering of comments.)
Line 1,423: Line 1,423:
(month, day) = (0, 1)
(month, day) = (0, 1)
print(
print(
# (A's month contains only one remaining day)
# (3 :: A "Then I also know")
# (3 :: A "Then I also know")
# (A's month contains only one remaining day)
uniquePairing(month)(
uniquePairing(month)(
# (B's day is paired with only one remaining month)
# (2 :: B "I know now")
# (2 :: B "I know now")
# (B's day is paired with only one remaining month)
uniquePairing(day)(
uniquePairing(day)(
# (A's month is not among those with unique days)
# (1 :: A "I know that Bernard does not know")
# (1 :: A "I know that Bernard does not know")
monthsWithUniqueDays(False)(
# (A's month is not among those with unique days)
monthsWithUniqueDays(False)([
# 0 :: Cheryl's list:
# 0 :: Cheryl's list:
list(map(
tuple(x.split()) for x in
lambda x: tuple(x.split()),
split(
split(
', ',
', ',
'May 15, May 16, May 19, ' +
'May 15, May 16, May 19, ' +
'June 17, June 18, ' +
'June 17, June 18, ' +
'July 14, July 16, ' +
'July 14, July 16, ' +
'Aug 14, Aug 15, Aug 17'
'Aug 14, Aug 15, Aug 17'
)
)
])
))
)
)
)
)
)