Let's prove that
The Hunting of the Snark is Nonsense:
-----------------------------------------------------------------------------------------------------
#! /usr/bin/python
statementList = [\
"I'm very much afraid I didn't mean anything but nonsense!",
"Just the place for a Snark!",
"Just the place for a Snark!",
"6 * 7 = 42",
"I'm very much afraid I didn't mean anything but nonsense!",
"6 * 7 = 39",
"6 * 7 = 39",
"Just the place for a Snark!",
"6 * 7 = 42",
"I'm very much afraid I didn't mean anything but nonsense!",
"6 * 7 = 39",
]
for s in (s for s in frozenset(statementList) if statementList.count(s) >= 3):\
print('"' + s + '" is true!')
-----------------------------------------------------------------------------------------------------
Yuck! Ipernity doesn't allow indentation as required by Python. But the code shown above works. It yields the same results as produced by
the more "pythonic" code shown in the screenshot:
-----------------------------------------------------------------------------------------------------
"I'm very much afraid I didn't mean anything but nonsense!" is true!
"6 * 7 = 39" is true!
"Just the place for a Snark!" is true!
-----------------------------------------------------------------------------------------------------
(Background image based on "Green on Green" by MJ Maccardini (trailerfullofpix)
2012-02-26,
www.ipernity.com/doc/goetzkluge/30126975)
1 comment
Götz Kluge said:
Lua: