test(r-1.2_scratch.py): discovered k&2 did not work

This commit is contained in:
baphim
2026-09-02 22:14:17 -04:00
parent 189b0dd155
commit efd340a5c2
+13 -2
View File
@@ -4,7 +4,18 @@
Created on Wed Sep 2 21:21:46 2026
@author: joseph
- I created this file to find out how binary operations would format output
after I realized that I couldn't k&2 because it was not reliable. I believe I
now understand it to be that & sets each bit to 0 if either bit is 0, therefore
when running k&2, it was printing the decimal version of the binary output,
which would be either 2 or 0.
"""
def is_even(k):
if k &
k = (int(input('Give a value for k... ')))
l = k & 2
print(l)