num="1F"
nm="1"
nm1="2"
hex(num)^hex(nm)^hex(nm1)
I wrote it like the code above, but hex doesn't work properly.
I want to convert the string to hexadecimal, and I want an xor operation of the converted value.
What should I do?
num="1F"
nm="1"
nm1="2"
hex(num)^hex(nm)^hex(nm1)
I wrote it like the code above, but hex doesn't work properly.
I want to convert the string to hexadecimal, and I want an xor operation of the converted value.
What should I do?
The variable num
can be converted to int using int(num, 16)
. Other variables nm
, nm1
are just integers in form of strings. to convert them use int(nm)
, int(nm1)
num = "1F"
nm = "1"
nm1 = "2"result = int(num, 16) ^ int(nm) ^ int(nm1)
print(result)> 28