Python offers some bit operations but not bit rotation. To complete that, create a function that takes three parameters:
n: Integer, which in binary representaion should be rotated.m: Number of rotation steps that should be performed.d: Boolean value; True = rotation right, False = rotation left.Your function should return an integer as a result of its rotated binary representation.
bit_rotate(8, 1, True) ➞ 4
# 8 in bin: 1000, rotated 1 step to the right: 0100, in dec: 4
bit_rotate(16, 1, False) ➞ 1
# 16 in bin: 10000, rotated 1 step to the left: 00001, in dec: 1
bit_rotate(17, 2, False) ➞ 6
# 17 in bin: 10001, rotated 2 steps to the left: 00110, in dec: 6