test(r-1.2_scratch.py): discovered k&2 did not work
This commit is contained in:
+13
-2
@@ -4,7 +4,18 @@
|
|||||||
Created on Wed Sep 2 21:21:46 2026
|
Created on Wed Sep 2 21:21:46 2026
|
||||||
|
|
||||||
@author: joseph
|
@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):
|
k = (int(input('Give a value for k... ')))
|
||||||
if k &
|
l = k & 2
|
||||||
|
print(l)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user