When I input
p [[2,1],3,4][1][1]
It will output 1.
Why is that happening?
[2,1]
creates an array with two elements (2
, 1
)[[2,1],3,4]
creates an array with three elements ([2,1]
, 3
and 4
)[1]
indexes that array and returns the second element 3
(indexing is 0 based)[1]
indexes the second bit of the number 3
(represented in binary as 11
) - aka 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With