Skip to main content
Commonmark migration
Source Link

Python 2,  20 21 33 39 45  50 bytes

Now very much a collaborative effort!

+2 thanks to Aidan F. Pierce (replace sorted({0}) with map(long,{0}))

+8 thanks to dylnan (use of \ and newline to replace space; suggestions to move from 0 to a mathematical expression; replacing -1 with -True; use of hexadecimal)

+11 thanks to Angs (4*23+~91 -> ~4836+9*1075/2 then later ~197836254+0xbCABdDF -> ~875+0xDEAdFBCbc%1439/2*6)


if\ map(long,{~875+0xDEAdFBCbc%1439/2*6})[-True]:q 

Try it online! Or see the confirmation suite

0xDEAdFBCbc is hexadecimal and evaluates to 59775106236.
~ is bit-wise complement so ~875 evaluates to -876.
% is the modulo operator so 0xDEAdFBCbc%1439 evaluates to 293.
/ is integer division so 0xDEAdFBCbc%1439/2 evaluates to 146.
* is multiplication so xDEAdFBCbc%1439/2*6 evaluates to 876.
+ is addition so ~875+xDEAdFBCbc%1439/2*6 evaluates to 0.
...no stripped version also evaluates to 0.

{0} is a set containing a single element, 0.

Calling sorted with a set as the argument yields a list, which may be indexed into with [...].

Without sorted the code ({0}) would just yield the set and this cannot be indexed into in the same fashion, if({0})[-True]:q would raise a TypeError.

Indexing in Python is 0-based and allows negative indexing from the back and True is equivalent to 1, hence sorted({0})[-True] finds the element 0, while sorted({0})[True] will raise an IndexError, as will sorted({})[-True] and sorted({0})[] is invalid syntax.

The 0 that is found is falsey so the body of the if, q, is never executed, however if it were it would raise a NameError since q has not been defined.

Since a non-empty list is truthy we cannot trim down to if[-1]:q either.

See the confirmation suite to see: confirmation the bytes being unique; all the errors; and the success of the code itself.

Python 2,  20 21 33 39 45  50 bytes

Now very much a collaborative effort!

+2 thanks to Aidan F. Pierce (replace sorted({0}) with map(long,{0}))

+8 thanks to dylnan (use of \ and newline to replace space; suggestions to move from 0 to a mathematical expression; replacing -1 with -True; use of hexadecimal)

+11 thanks to Angs (4*23+~91 -> ~4836+9*1075/2 then later ~197836254+0xbCABdDF -> ~875+0xDEAdFBCbc%1439/2*6)


if\ map(long,{~875+0xDEAdFBCbc%1439/2*6})[-True]:q 

Try it online! Or see the confirmation suite

0xDEAdFBCbc is hexadecimal and evaluates to 59775106236.
~ is bit-wise complement so ~875 evaluates to -876.
% is the modulo operator so 0xDEAdFBCbc%1439 evaluates to 293.
/ is integer division so 0xDEAdFBCbc%1439/2 evaluates to 146.
* is multiplication so xDEAdFBCbc%1439/2*6 evaluates to 876.
+ is addition so ~875+xDEAdFBCbc%1439/2*6 evaluates to 0.
...no stripped version also evaluates to 0.

{0} is a set containing a single element, 0.

Calling sorted with a set as the argument yields a list, which may be indexed into with [...].

Without sorted the code ({0}) would just yield the set and this cannot be indexed into in the same fashion, if({0})[-True]:q would raise a TypeError.

Indexing in Python is 0-based and allows negative indexing from the back and True is equivalent to 1, hence sorted({0})[-True] finds the element 0, while sorted({0})[True] will raise an IndexError, as will sorted({})[-True] and sorted({0})[] is invalid syntax.

The 0 that is found is falsey so the body of the if, q, is never executed, however if it were it would raise a NameError since q has not been defined.

Since a non-empty list is truthy we cannot trim down to if[-1]:q either.

See the confirmation suite to see: confirmation the bytes being unique; all the errors; and the success of the code itself.

Python 2,  20 21 33 39 45  50 bytes

Now very much a collaborative effort!

+2 thanks to Aidan F. Pierce (replace sorted({0}) with map(long,{0}))

+8 thanks to dylnan (use of \ and newline to replace space; suggestions to move from 0 to a mathematical expression; replacing -1 with -True; use of hexadecimal)

+11 thanks to Angs (4*23+~91 -> ~4836+9*1075/2 then later ~197836254+0xbCABdDF -> ~875+0xDEAdFBCbc%1439/2*6)


if\ map(long,{~875+0xDEAdFBCbc%1439/2*6})[-True]:q 

Try it online! Or see the confirmation suite

0xDEAdFBCbc is hexadecimal and evaluates to 59775106236.
~ is bit-wise complement so ~875 evaluates to -876.
% is the modulo operator so 0xDEAdFBCbc%1439 evaluates to 293.
/ is integer division so 0xDEAdFBCbc%1439/2 evaluates to 146.
* is multiplication so xDEAdFBCbc%1439/2*6 evaluates to 876.
+ is addition so ~875+xDEAdFBCbc%1439/2*6 evaluates to 0.
...no stripped version also evaluates to 0.

{0} is a set containing a single element, 0.

Calling sorted with a set as the argument yields a list, which may be indexed into with [...].

Without sorted the code ({0}) would just yield the set and this cannot be indexed into in the same fashion, if({0})[-True]:q would raise a TypeError.

Indexing in Python is 0-based and allows negative indexing from the back and True is equivalent to 1, hence sorted({0})[-True] finds the element 0, while sorted({0})[True] will raise an IndexError, as will sorted({})[-True] and sorted({0})[] is invalid syntax.

The 0 that is found is falsey so the body of the if, q, is never executed, however if it were it would raise a NameError since q has not been defined.

Since a non-empty list is truthy we cannot trim down to if[-1]:q either.

See the confirmation suite to see: confirmation the bytes being unique; all the errors; and the success of the code itself.

added 243 characters in body
Source Link
Jonathan Allan
  • 115.5k
  • 8
  • 68
  • 293

Python 2,  20 21 33 39 45  50 bytes

Now very much a collaborative effort!

+2 thanks to Aidan F. Pierce (replace sorted({0}) with map(long,{0}))

+8 thanks to dylnan (use of \ and newline to replace space; suggestions to move from 0 to a mathematical expression; replacing -1 with -True; use of hexadecimal)

+11 thanks to Angs (4*23+~91 -> ~4836+9*1075/2 then later ~197836254+0xbCABdDF -> ~875+0xDEAdFBCbc%1439/2*6)


if\ map(long,{~875+0xDEAdFBCbc%1439/2*6})[-True]:q 

Try it online! Or see the confirmation suite

0xbCABdDF0xDEAdFBCbc is hexadecimal and evaluates to 19783625559775106236.   
~ is bit-wise complement so ~197836254~875 evaluates to -197836255876. Thus
% is the modulo operator so ~197836254+0xbCABdDF0xDEAdFBCbc%1439 evaluates to 293.
/ is integer division so 0xDEAdFBCbc%1439/2 evaluates to 146.
* is multiplication so xDEAdFBCbc%1439/2*6 evaluates to 876.
+ is addition so ~875+xDEAdFBCbc%1439/2*6 evaluates to 0, and no.
...no stripped version also doesevaluates to 0.

{0} is a set containing a single element, 0.

Calling sorted with a set as the argument yields a list, which may be indexed into with [...].

Without sorted the code ({0}) would just yield the set and this cannot be indexed into in the same fashion, if({0})[-True]:q would raise a TypeError.

Indexing in Python is 0-based and allows negative indexing from the back and True is equivalent to 1, hence sorted({0})[-True] finds the element 0, while sorted({0})[True] will raise an IndexError, as will sorted({})[-True] and sorted({0})[] is invalid syntax.

The 0 that is found is falsey so the body of the if, q, is never executed, however if it were it would raise a NameError since q has not been defined.

Since a non-empty list is truthy we cannot trim down to if[-1]:q either.

See the confirmation suite to see: confirmation the bytes being unique; all the errors; and the success of the code itself.

Python 2,  20 21 33 39 45  50 bytes

Now very much a collaborative effort!

+2 thanks to Aidan F. Pierce (replace sorted({0}) with map(long,{0}))

+8 thanks to dylnan (use of \ and newline to replace space; suggestions to move from 0 to a mathematical expression; replacing -1 with -True; use of hexadecimal)

+11 thanks to Angs (4*23+~91 -> ~4836+9*1075/2 then later ~197836254+0xbCABdDF -> ~875+0xDEAdFBCbc%1439/2*6)


if\ map(long,{~875+0xDEAdFBCbc%1439/2*6})[-True]:q 

Try it online! Or see the confirmation suite

0xbCABdDF is hexadecimal and evaluates to 197836255.  ~ is bit-wise complement so ~197836254 evaluates to -197836255. Thus ~197836254+0xbCABdDF evaluates to 0, and no stripped version also does.

{0} is a set containing a single element, 0.

Calling sorted with a set as the argument yields a list, which may be indexed into with [...].

Without sorted the code ({0}) would just yield the set and this cannot be indexed into in the same fashion, if({0})[-True]:q would raise a TypeError.

Indexing in Python is 0-based and allows negative indexing from the back and True is equivalent to 1, hence sorted({0})[-True] finds the element 0, while sorted({0})[True] will raise an IndexError, as will sorted({})[-True] and sorted({0})[] is invalid syntax.

The 0 that is found is falsey so the body of the if, q, is never executed, however if it were it would raise a NameError since q has not been defined.

Since a non-empty list is truthy we cannot trim down to if[-1]:q either.

See the confirmation suite to see: confirmation the bytes being unique; all the errors; and the success of the code itself.

Python 2,  20 21 33 39 45  50 bytes

Now very much a collaborative effort!

+2 thanks to Aidan F. Pierce (replace sorted({0}) with map(long,{0}))

+8 thanks to dylnan (use of \ and newline to replace space; suggestions to move from 0 to a mathematical expression; replacing -1 with -True; use of hexadecimal)

+11 thanks to Angs (4*23+~91 -> ~4836+9*1075/2 then later ~197836254+0xbCABdDF -> ~875+0xDEAdFBCbc%1439/2*6)


if\ map(long,{~875+0xDEAdFBCbc%1439/2*6})[-True]:q 

Try it online! Or see the confirmation suite

0xDEAdFBCbc is hexadecimal and evaluates to 59775106236. 
~ is bit-wise complement so ~875 evaluates to -876.
% is the modulo operator so 0xDEAdFBCbc%1439 evaluates to 293.
/ is integer division so 0xDEAdFBCbc%1439/2 evaluates to 146.
* is multiplication so xDEAdFBCbc%1439/2*6 evaluates to 876.
+ is addition so ~875+xDEAdFBCbc%1439/2*6 evaluates to 0.
...no stripped version also evaluates to 0.

{0} is a set containing a single element, 0.

Calling sorted with a set as the argument yields a list, which may be indexed into with [...].

Without sorted the code ({0}) would just yield the set and this cannot be indexed into in the same fashion, if({0})[-True]:q would raise a TypeError.

Indexing in Python is 0-based and allows negative indexing from the back and True is equivalent to 1, hence sorted({0})[-True] finds the element 0, while sorted({0})[True] will raise an IndexError, as will sorted({})[-True] and sorted({0})[] is invalid syntax.

The 0 that is found is falsey so the body of the if, q, is never executed, however if it were it would raise a NameError since q has not been defined.

Since a non-empty list is truthy we cannot trim down to if[-1]:q either.

See the confirmation suite to see: confirmation the bytes being unique; all the errors; and the success of the code itself.

Python 2,  20 21 33 39 45  50 bytes

Now very much a collaborative effort!

+2 thanks to Aidan F. Pierce (replace sorted({0}) with map(long,{0}))

+8 thanks to dylnan (use of \ and newline to replace space; suggestions to move from 0 to a mathematical expression; replacing -1 with -True; use of hexadecimal)

+11 thanks to Angs (4*23+~91 -> ~4836+9*1075/2 then later ~197836254+0xbCABdDF -> ~875+0xDEAdFBCbc%1439/2*6)


if\ map(long,{~875+0xDEAdFBCbc%1439/2*6})[-True]:q 

Try it online! Or see the confirmation suite

0xbCABdDF is hexadecimal and evaluates to evaluates to 197836255. ~ is bit-wise complement so ~197836254 evaluates to -197836255. Thus ~197836254+0xbCABdDF evaluates to 0, and no stripped version also does.

{0} is a set containing a single element, 0.

Calling sorted with a set as the argument yields a list, which may be indexed into with [...].

Without sorted the code ({0}) would just yield the set and this cannot be indexed into in the same fashion, if({0})[-True]:q would raise a TypeError.

Indexing in Python is 0-based and allows negative indexing from the back and True is equivalent to 1, hence sorted({0})[-True] finds the element 0, while sorted({0})[True] will raise an IndexError, as will sorted({})[-True] and sorted({0})[] is invalid syntax.

The 0 that is found is falsey so the body of the if, q, is never executed, however if it were it would raise a NameError since q has not been defined.

Since a non-empty list is truthy we cannot trim down to if[-1]:q either.

See the confirmation suite to see: confirmation the bytes being unique; all the errors; and the success of the code itself.

Python 2,  20 21 33 39 45  50 bytes

Now very much a collaborative effort!

+2 thanks to Aidan F. Pierce (replace sorted({0}) with map(long,{0}))

+8 thanks to dylnan (use of \ and newline to replace space; suggestions to move from 0 to a mathematical expression; replacing -1 with -True; use of hexadecimal)

+11 thanks to Angs (4*23+~91 -> ~4836+9*1075/2 then later ~197836254+0xbCABdDF -> ~875+0xDEAdFBCbc%1439/2*6)


if\ map(long,{~875+0xDEAdFBCbc%1439/2*6})[-True]:q 

Try it online! Or see the confirmation suite

0xbCABdDF is hexadecimal and evaluates to evaluates to 197836255. ~ is bit-wise complement so ~197836254 evaluates to -197836255. Thus ~197836254+0xbCABdDF evaluates to 0, and no stripped version also does.

{0} is a set containing a single element, 0.

Calling sorted with a set as the argument yields a list, which may be indexed into with [...].

Without sorted the code ({0}) would just yield the set and this cannot be indexed into in the same fashion, if({0})[-True]:q would raise a TypeError.

Indexing in Python is 0-based and allows negative indexing from the back and True is equivalent to 1, hence sorted({0})[-True] finds the element 0, while sorted({0})[True] will raise an IndexError, as will sorted({})[-True] and sorted({0})[] is invalid syntax.

The 0 that is found is falsey so the body of the if, q, is never executed, however if it were it would raise a NameError since q has not been defined.

Since a non-empty list is truthy we cannot trim down to if[-1]:q either.

See the confirmation suite to see: confirmation the bytes being unique; all the errors; and the success of the code itself.

Python 2,  20 21 33 39 45  50 bytes

Now very much a collaborative effort!

+2 thanks to Aidan F. Pierce (replace sorted({0}) with map(long,{0}))

+8 thanks to dylnan (use of \ and newline to replace space; suggestions to move from 0 to a mathematical expression; replacing -1 with -True; use of hexadecimal)

+11 thanks to Angs (4*23+~91 -> ~4836+9*1075/2 then later ~197836254+0xbCABdDF -> ~875+0xDEAdFBCbc%1439/2*6)


if\ map(long,{~875+0xDEAdFBCbc%1439/2*6})[-True]:q 

Try it online! Or see the confirmation suite

0xbCABdDF is hexadecimal and evaluates to 197836255. ~ is bit-wise complement so ~197836254 evaluates to -197836255. Thus ~197836254+0xbCABdDF evaluates to 0, and no stripped version also does.

{0} is a set containing a single element, 0.

Calling sorted with a set as the argument yields a list, which may be indexed into with [...].

Without sorted the code ({0}) would just yield the set and this cannot be indexed into in the same fashion, if({0})[-True]:q would raise a TypeError.

Indexing in Python is 0-based and allows negative indexing from the back and True is equivalent to 1, hence sorted({0})[-True] finds the element 0, while sorted({0})[True] will raise an IndexError, as will sorted({})[-True] and sorted({0})[] is invalid syntax.

The 0 that is found is falsey so the body of the if, q, is never executed, however if it were it would raise a NameError since q has not been defined.

Since a non-empty list is truthy we cannot trim down to if[-1]:q either.

See the confirmation suite to see: confirmation the bytes being unique; all the errors; and the success of the code itself.

added 135 characters in body
Source Link
Jonathan Allan
  • 115.5k
  • 8
  • 68
  • 293
Loading
added 190 characters in body
Source Link
Jonathan Allan
  • 115.5k
  • 8
  • 68
  • 293
Loading
added 197 characters in body
Source Link
Jonathan Allan
  • 115.5k
  • 8
  • 68
  • 293
Loading
added 77 characters in body
Source Link
Jonathan Allan
  • 115.5k
  • 8
  • 68
  • 293
Loading
added 118 characters in body
Source Link
Jonathan Allan
  • 115.5k
  • 8
  • 68
  • 293
Loading
Rollback to Revision 7
Source Link
Jonathan Allan
  • 115.5k
  • 8
  • 68
  • 293
Loading
added 57 characters in body; added 17 characters in body; added 44 characters in body
Source Link
Jonathan Allan
  • 115.5k
  • 8
  • 68
  • 293
Loading
added 500 characters in body
Source Link
Jonathan Allan
  • 115.5k
  • 8
  • 68
  • 293
Loading
added 95 characters in body
Source Link
Jonathan Allan
  • 115.5k
  • 8
  • 68
  • 293
Loading
added 2 characters in body
Source Link
Jonathan Allan
  • 115.5k
  • 8
  • 68
  • 293
Loading
Post Undeleted by Jonathan Allan
added 2 characters in body
Source Link
Jonathan Allan
  • 115.5k
  • 8
  • 68
  • 293
Loading
Post Deleted by Jonathan Allan
Post Undeleted by Jonathan Allan
deleted 42 characters in body
Source Link
Jonathan Allan
  • 115.5k
  • 8
  • 68
  • 293
Loading
added 33 characters in body
Source Link
Jonathan Allan
  • 115.5k
  • 8
  • 68
  • 293
Loading
Post Deleted by Jonathan Allan
Source Link
Jonathan Allan
  • 115.5k
  • 8
  • 68
  • 293
Loading