Write Function to right rotate n by d bits
Topic: Write Function to right rotate n by d bits
Solution
def rightRotate(n, d): INT_BITS = 32 return (n >> d)|(n << (INT_BITS - d)) & 0xFFFFFFFF n = 16 d = 2 print("Right Rotation of",n,"by",d,"is",end=" ") print(rightRotate(n, d))
List all Python Programs