Rule of 3


#! /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 + '" must be true.')


(The code in the image is older than the code above the image, but looks nicer.
The background image is based on Green on Green by MJ Maccardini, 2012-26-02.)


#! /usr/bin/lua
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",
    }
statementcount = {}
for _,statement in ipairs(statementlist) do
    local count = (statementcount[statement] or 0) + 1
    statementcount[statement] = count
    if count == 3 then print('"'..statement..'" is true!') end
end


Haskell for the President

Consent Management Platform by Real Cookie Banner