Do You Know How `or` and `and` Work in Python?

(thepythoncodingstack.com)

2 points | by rbanffy 16 hours ago ago

3 comments

  • wredcoll 16 hours ago ago

    I don't know how you would test this, but I feel like far more programmers have grown up in a world where `x or y` evaluates to x if it's truthy.

    How many people expect some abstract boolean only system?

    • _wire_ 13 hours ago ago

      You forgot the spaces between Fish and And and And and Chips... and Chips and Or and Or and Slaw.

      The scaling of ands in the first part is "given by an easy formula for generating the length of a string from the previous one: it's a_(n+1) = 2a_n + (2a_n + 1) = 4a_n + 1, which WolframAlpha converts to the explicit sequence a_n = (4n-1)/3"

      Source

      https://www.reddit.com/r/math/comments/1021az/how_many_conse...

      The scaling of ands in the second part is decided using an ancient mystical and arcane curse based on tail-end recursion applied to the first part to find the mean reciprocal of the target of the second, then add 3.

      HTH!

      I'll be here all week... Try the veal!

  • BobbyTables2 12 hours ago ago

    True or False