Operator Precedence/Boolean Logic

Marko Rauhamaa marko at pacujo.net
Thu Jun 23 05:46:06 EDT 2016


Steven D'Aprano <steve+comp.lang.python at pearwood.info>:

> On Thursday 23 June 2016 18:32, Andreas Röhler wrote:
>
>> There is a fundamental diff between zero and emptiness.
>
> In English, "emptiness" implies a container (real or figurative). The
> container is not "something or nothing", it is the *contents* being
> referred to.
>
> "This shopping bag is empty" doesn't mean the shopping bag is nothing.
> It means that the set of items in the bad is the null set, i.e. there
> are ZERO items in the bag.

I once read this puzzle in a book:

   There was a shipwreck in the middle of an ocean. The ship and the
   cargo were lost, but five sailors managed to swim to the beach of a
   nearby island. After quick scouting, the sailors realized they were
   on a tiny desert island with lots of coconut trees loaded with
   coconuts.

   The sailors set out to collect all coconuts they could find. After
   several hours, they had finished the job and made a sizeable pile of
   coconuts on the beach. They were exhausted and it was getting dark so
   they agreed to divide the pile evenly between each other on the
   following morning. They camped on the beach for the night.

   One of the sailors couldn't sleep. Would the others give him his
   share? What if they overpowered him and left him without coconuts? He
   sneaked to the pile of coconuts, split the big pile evenly into five
   smaller piles. One was left over, he threw it to a monkey that was
   watching nearby. He took his fifth, carried the coconuts to a secret
   location, and put the rest of the coconuts in a single pile so others
   wouldn't notice the loss. He went back to the camp and fell sound
   asleep.

   Another sailer woke up. What if he wouldn't get his share of the
   coconuts? He went to the big pile, divided it evenly into five
   smaller piles (one coconut was left over -- he threw it to the
   monkey), hid his share, put the big pile back together, and went to
   sleep.

   Before dawn, each of the sailors had gone through the same exercise.
   When they woke up, they went to the pile. Everyone noticed the pile
   had shrunk during the night but nobody mentioned it. They divided the
   pile evenly between the five. One coconut was left over and they
   threw it to the monkey.

   How many coconuts were there in the pile originally?


The book went on to find the answer(s), but gave also this interesting
side solution:

   The pile originally had -4 coconuts. The first sailor threw one to
   the monkey, leaving -5 coconuts in the pile. He took his share (-1
   coconut) out and put the remaining -4 coconuts back in the big pile.

   And so on.


Ridiculous? It was this line of thinking that led Paul Dirac to predict
the existence of antimatter.


Marko



More information about the Python-list mailing list