miniprojekt3
This commit is contained in:
parent
695672a7dd
commit
3312ecae2a
21
miniprojekt3/zadania.py
Normal file
21
miniprojekt3/zadania.py
Normal file
@ -0,0 +1,21 @@
|
||||
# dodawanie hex
|
||||
|
||||
xhex = "ae"
|
||||
yhex = "11"
|
||||
|
||||
scale = 16
|
||||
num_of_bits = 8
|
||||
|
||||
xbin = bin(int(xhex, scale))[2:].zfill(num_of_bits)
|
||||
#print(xbin)
|
||||
|
||||
ybin = bin(int(yhex, scale))[2:].zfill(num_of_bits)
|
||||
#print(ybin)
|
||||
|
||||
result = ""
|
||||
for idx, b in enumerate(xbin):
|
||||
result += str(int(b) ^ int(ybin[idx]))
|
||||
|
||||
hexresult = hex(int(result, 2))
|
||||
|
||||
print(hexresult)
|
Loading…
Reference in New Issue
Block a user