I have a list of hex values and I need to shift eacgh element by 9 and combine the result with another list. I have provided an example below of what I tried.
x = [hex(10), hex(11)]
y = x[0] << 1
This results in an error:
TypeError: unsupported operand type(s) for <<: 'str' and 'int'
While the below code works as I like but returns an int
x = [0xa, 0xb]
y = x[0] << 1
My question is how can I get the first code example to work?
I understand that the list is returning a string and not an int. I tried to type cast from a str to a hex, but this caused an error. I then tried to type cast from the string to int to hex and received an error for the str to int type cast.
I need to result to be stored as a hex in the list so changing the list to integers would not work for me.